Restoring a mysqldump backup involves feeding the SQL file back into MySQL. The process recreates tables, stored procedures, and data exactly as they were at backup time.
Basic Restore
Use the mysql command-line client and redirect the SQL file as input. If the database does not exist yet, create it first with CREATE DATABASE.
Restore Best Practices
- Restore to a test server first to verify integrity before applying to production
- Disable foreign key checks during restore to avoid ordering issues (SET FOREIGN_KEY_CHECKS=0)
- Use --force on the mysql command to continue past errors
- Monitor the restore progress with pv (pipe viewer) for large files
Partial Restore
To restore only specific tables, extract the relevant INSERT statements from the dump file using grep or sed, then apply those statements manually.