MySQL:Backup and Restore


 * Home
 * Administration Tools
 * Backup and Restore
 * Security
 * User Account Management
 * Utility

Backup
Use the mysqldump utility from the bin directory without logging into the mysql utility. To backup your database(s), use the following sytanx: mysqldump –u[user name] –p[password] [database name] > [dump file]

Example:

C:\xampp\mysql\bin>mysqldump –uroot –pmyrootpassword db_test > db_test.sql

You can also specify multiple databases or all databases by using the following sytax: mysqldump –u[user name] –p[password] [database name 1] [database name 2] > [dump file]

Example:

C:\xampp\mysql\bin>mysqldump –-user root –-password=myrootpassword db_test db_second db_third > db_test.sql

To backup all databases running in your mysql utility use the following sytax: mysqldump –u[user name] –p[password] –all-databases > [dump file]

Example: C:\xampp\mysql\bin>mysqldump –-user root –-password=myrootpassword --all-databases > db_test.sql

Restore
Mysqldump is used only in backing up your databases. To restore you must use the mysql utility. Restoring requires the use of the files that you backed up previously in the backup process. To restore use the following syntax: mysql --u [username] --password=[password] [database name] < [dump file]

Example:

C:\xampp\mysql\bin>mysql --user root --password=myrootpassword new_db < db_test.sql