Backup MySQL databases use mysqldump/mysql

1.backup Mysql database:

mysqldump -u user -h hostip -p databasename   > backupname.sql

then enter password and wait;

2. restore MySQL database:

First,  established a database named datanasename,than

mysql -u user -h hostip -p databasename   < backupname.sql

or

source filename.sql

3. Migrate Database;

1.abc.com -> 2.abc.com

mysqldump -h 1.abc.com  -u root -p databasename |  mysql -h 2.abc.com -u root -p

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *