Backup and Restore MySQL Database Using mysqldump

Backup and Restore MySQL Database Using mysqldump

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sqlrestore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

The following example takes a backup of  all the database of the MySQL instance

# mysqldump -u root -ptmppassword –all-databases > /tmp/all-database.sql

Backup a specific table:

# mysqldump -u root -ptmppassword sugarcrm accounts_contacts \      > /tmp/sugarcrm_accounts_contacts.sql

Backup multiple databases:

#mysqldump -u root -ptmppassword --databases db1 db3 > db1_db2.sql

Backup a local database and restore to remote server using single command

#mysqldump -u root -ptmppassword db1 | mysql \ -u root -ptmppassword --host=remote-server -C db1