How do I backup MySQL database?

Posted in

In this Article

  • Backup your MySQL database via phpMyAdmin in cPanel
  • Backup your MySQL database using the command line
  • Backup your MySQL database using MySQL Workbench

Backing up your MySQL Database can be done in several ways:

  1. Using phpMyAdmin web interface.
  2. Using command line through shell access.
  3. Using MySQL Workbench.

(1) Using phpMyAdmin

Login to your cPanel control panel find the “Databases” section and click on “phpMyAdmin“. On the new page that opens, select your database on the left sidebar and follow the steps below:

  1. At the top click “Export
  2. Select “Custom – …”
  3. Select “Compression” > “None” or “Zipped” or “Gzipped” etc. I usually select “Zipped
  4. Scroll down to the bottom and click “Go

You will be prompted to save the dump file on your computer, and your done.

(2) Using MySQL command line tools

To use MySQL command line tools, you will need SSH access to be enabled on your hosting account. You can perform backup using the following command:

mysqldump -h servername -u username -p –add-drop-table –create-options –skip-add-locks -e –set-charset –disable-keys -Q databasename > databasedump.sql

To backup and compress your dump file:

mysqldump -h servername -u username -p –add-drop-table –create-options -e –set-charset –skip-add-locks –disable-keys -Q databasename | gzip > databasedump.sql.gz

The commands above will create the dump file in your current directory. You can download this backup file using scp or ftp for your archival purposes. If you perform this command in the public_html directory (or if you move the file into the public_html directory), you will be able to download this file from the web.

(3) You can download MySQL Workbench

From – this will allow you to connect to the MySQL process on the server directly and create a local backup of the data.

Have a comment or question?

Grow your business with a beautiful new


Website Package
Scroll to Top