Backup and Restore MySQL Database
Backup One Database
> mysqldump -uusername -ppassword databasename > database-backup.sql
Backup Multiple Tables in a Database
> mysqldump -uusername -ppassword databasename specific_table1 specific_table2 > database-backup.sql
Backup Multiple Databases
> mysqldump -uusername -ppassword –databases databasename1 databasename2 databasename3 > database-backup.sql
Backup the Structure of a Database
> mysqldump --no-data -uusername -ppassword databasename > database-structure.sql
Backup the Structures of Multiple Databases
> mysqldump --no-data -uusername -ppassword –-databases databasename1 databasename2 databasename3 > database-structure.sql
Backup All Databases
> mysqldump –all-databases > database-backup.sql
Restore a Database
>mysql -uusername -ppassword databasename < database-backup.sql