- Backup A Single Database
mysqldump -u root -p dbname > dbname.sql
Where:
dbname = is the name of the database to backup
dbname.sql = is the name of the backup file, can also be location of backup file - Restore A Single Database
mysqldump -u root -p dbname < dbname.sql - Backup All Databases
mysqldump -u root -p --all-databases > All-dbname.sql - Restore Single Database from All Database Backup
mysql -u root -p --one-database dbname < All-dbname.sql