In general, to perform backup/restore mysql database we can use the command:
1 2 |
Backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql Restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql |
Backup a single database:
1 |
# mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql |
Backup multiple databases:
1 |
# mysqldump -u root -ptmppassword --databases [database 1] [database 2] > backup.sql |
Backup all the databases:
1 |
# mysqldump -u root -ptmppassword --all-databases > backup-all-database.sql |
Backup a specific table:
1 |
# mysqldump -u root -ptmppassword [database] [table] > table.sql |