Low Orbit Flux Logo 2 F

How To Backup MySQL Database

Backups are really important. Fortunately it is easy to backup a MySQL database.

Create a backup using the mysqldump command like this:



mysqldump -u myuser -p mydatabase1 > mydatabase1_backup_2053-10-15.sql

You can verify that the backup file is valid like this. It should contain all of the SQL commands needed to re-create your database.



cat mydatabase_backup.sql

You can restore your database like this:



mysql -u username -p mydatabase1 < mydatabase1_backup_2053-10-15.sql

Video Instructions