Skip to end of metadata
Go to start of metadata

mysqldump enables you to backup all the necessary database you need, and mysql enables you to restore the dumped data on linux console.

Backup(dump) database

# dump a database(chun) to ck_mysql_backup.sql
mysqldump -u<user_id> -p<user_password> chun > ck_mysql_backup.sql

# dump all databases in the system to ck_mysql_backup.sql
mysqldump -u<user_id> -p<user_password> --all-databases > ck_mysql_backup.sql

# dump a database(chun) in a remote(1.2.3.4) to ck_mysql_backup.sql
mysqldump --port=3306 --host=1.2.3.4 -u<user_id> -p<user_password> chun > ck_mysql_backup.sql

# dump all databases in a remote server(1.2.3.4) to ck_mysql_backup.sql
mysqldump --port=3306 --host=1.2.3.4 -u<user_id> -p<user_password> --all-databases > ck_mysql_backup.sql


mysql --port=3306 --host=192.168.10.9 -unewid_dba -pNewideoqkr33\!\! newid < ck_mysql_backup.sql
mysql --port=3306 --host=192.168.10.9 -unewid_dba -pNewideoqkr33\!\! newid_stg < ck_mysql_backup.sql


Restore database

# restore a database(chun) from ck_mysql_backup.sql
mysql -u<user_id> -p<user_password> chun < ck_mysql_backup.sql

# restore all databases in the system from ck_mysql_backup.sql
mysql -u<user_id> -p<user_password> < ck_mysql_backup.sql

# restore a database(chun) in a remote(1.2.3.4) from ck_mysql_backup.sql
mysql --port=3306 --host=1.2.3.4 -u<user_id> -p<user_password> chun < ck_mysql_backup.sql

# restore all databases in a remote server(1.2.3.4) from ck_mysql_backup.sql
mysql --port=3306 --host=1.2.3.4 -u<user_id> -p<user_password> < ck_mysql_backup.sql