Backup and Restore MySQL Databases

From banana_wiki
Jump to: navigation, search

This will use the usually included mysqldump command

Backup an single database

mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

Restore a single database

mysql -u root -p[root_password] [database_name] < dumpfilename.sql

Backup multiple databases

mysqldump -u root -ptmppassword --databases bugs sugarcrm > bugs_sugarcrm.sql

Backup all databases

mysqldump -u root -ptmppassword --all-databases > /tmp/all-database.sql