MySQL – Backup & Restore A Database

Dump all databases

mysqldump -u <USERNAME> -p<PASSWORD> --all-databases > alldatabases.sql

Dump Multiple/Specific Databases

mysqldump -u <USERNAME> -p<PASSWORD> -databases db_name1 [db_name2 ...] > alldatabases.sql

Dump (Backup) A Single Database

mysqldump -u <USERNAME> -p<PASSWORD> <DATABASE_NAME> > <DATABASE_NAME>.sql

Restore A Single Database

mysql -u <USERNAME> -p<PASSWORD> <DATABASE_NAME> < <DATABASE_NAME>.sql