Knowledge Base

How can I backup and restore database?

Article ID: 226
Last updated: 19 Jul, 2018

You can use mysqldump to create a simple backup of your database using the following syntax:

Backup: 

mysqldump -u [username] -p[password] -h[host]  [databasename] > [backupfile.sql]

Restore:

 mysql -u [username] -p[password] -h[host]  [databasename] < [backupfile.sql]

  • [username] - this is your database username
  • [password] - this is the password for your database
  • [databasename] - the name of your database
  • [host] - this is db hostname (optional)
  • [backupfile.sql] - the file to which the backup should be written/read.

Article ID: 226
Last updated: 19 Jul, 2018
Revision: 3
Access: Public
Views: 6868
Comments: 0
External links