Export or backup MySQL Database
Posted by Rick G. on 02 May 2015 11:37 AM

Exporting or backing up a MySQL database can be done either via the cPanel using the Backup utilities or more preferably via SSH using the folloiwng Command.  Using SSH to perform the MySQL export or "dump" is much more convenient and less prone to timeout errors that browser based systems may encounter on large databases.  Simply loging to your account via SSH and perform the following command.

mysqldump -u DBUSER -pDBPASS DBNAME > dump.sql

Replace text in uppercase with the appropriate information:

  • DBUSER - Database user with privileges to the database
  • DBPASS - Password for the database user
  • DBNAME - Database name

Please note, if your password contains special characters (* ? [ < > & ; ! | $), you will either need to escape them with a backslash, put the password between single quotes, or leave the password out (you'll be prompted to enter password). Here are some examples:

Escaped Password

mysqldump -u DBUSER -pM\*Y\?P\[A\<S\>S\&W\;O\!R\|D\$ DBNAME > dump.sql

Password In Quotes

>mysqldump -u DBUSER -p'M*Y?P[A<S>S&W;O!R|D$' DBNAME > dump.sql

No Password

mysqldump -u DBUSER -p DBNAME > dump.sql

Also, if you're trying to export a database that's located on a different server, you'll need to set the database server hostname (by default the hostname is localhost or

mysqldump -h DBHOST -u DBUSER -p DBNAME > dump.sql
(1 vote(s))
This article was helpful
This article was not helpful