How to Restore MySQL Database

To restore a backup of MySQL database or databases, the following commands would be used.

The format of the command is 

# mysqldump -u [username] –p[password] [database_name] < [dump_file.sql]

 To restore Remote MySQL Database

# mysqldump –h ipaddress -u [username] –p[password] [database_name] < [dump_file.sql]

 To restore a single or multiple database(s):

# mysql -u root  –proot123 MYDB1 < MYDB1.sql

 If you want to restore a database that already exists on targeted machine, then you will need to use the mysqlimport command.

 # mysqlimport -u root –proot123 MYDB1 < MYDB1.sql

Note:

To backup MYSQL DB, you can refer my blog

No comments:

Post a Comment