≡ Menu

How to Backup/Restore Mysql Database

In general, to perform backup/restore mysql database we can use the command:

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:

# mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

Backup multiple databases:

# mysqldump -u root -ptmppassword --databases [database 1] [database 2] > backup.sql

Backup all the databases:

# mysqldump -u root -ptmppassword --all-databases > backup-all-database.sql

Backup a specific table:

# mysqldump -u root -ptmppassword [database] [table] > table.sql
{ 0 comments… add one }

Leave a Comment

CAPTCHA
*