Saturday, June 20, 2009

MySQL 5.1 Backup / Restore

Here is the process I came up with to backup and restore a MySQL v5.1.34 Database

To Backup:
mysqldump -u root --password=PASSWORD dbname > c:\mysqlbackups\backupfile.sql

This can then easily be entered into a batch file and run via scheduled tasks for regular backups.

To Restore:
mysql -u root --password=PASSWORD dbname < c:\mysqlbackups\backupfile.sql

Note: mysql and mysqldump are located in the installation directories bin folder

It's also important to note that the generated backup file could be used in other DB engines since it is just SQL statements that recreate the DB and populate the data.

No comments:

Post a Comment