Saturday 28 March 2009

Backup of all MySQL databases

To backup all MySQL databases on a machine, use the following command: -



mysqldump -u root -psecret --all-databases > backup.sql
To restore all databases, use the following command: -

mysql -u root -psecret < backup.sql

To restore a single database (from a cpanel backup etc), use the following command: -

mysql -u user -psecret dbname < dbbackup.sql

No comments:

Post a Comment