Lesson 28 / 28
Backup & Restore
Save and reload a database with mysqldump.
Backing up
mysqldump writes the schema and data as SQL statements to a file.
mysqldump -u root -p shop > shop_backup.sqlRestoring
Feed the dump file back into mysql to recreate the database exactly.
mysql -u root -p shop < shop_backup.sqlAutomate it
Schedule mysqldump with cron for regular backups — a single lost server shouldn't mean lost data.