Singapore & Australia # 1 for Web Hosting & Domains
SG: +65 6018 3544   AU: 1300-863-436 Asset 1colo Help
Vodien Logo
  1. Home
  2. Knowledge Base
  3. Secure Shell
  4. How to export MySQL database using SSH?

How to export MySQL database using SSH?

A faster way of exporting your database is via Secure Shell. Learn how to export MySQL database using SSH by following the instructions below.

(Please note that this is only applicable to Dedicated Server and VPS hosting packages only. If you are in a Shared Hosting plan, you may export MySQL via phpMyAdmin.)

Export MySQL database using SSH (Secure Shell)

Step 1. Connect to SSH.

Step 2. Type  pwd to check your current directory.

Step 3. Go to the specific directory where you want the SQL file to be saved. Use the following command:

cd /home/cPanel_username/public_html/directory

Replace cPanel_username with the correct cPanel username and directory with the correct directory name. Press Enter.

Step 4. Execute the following command (no. 1 in the image below).

mysqldump --no-create-db=true -h localhost -u sql_username -p sql_databasename > sqlfilename.sql

(Note: Replace sql_username with the correct database username, sql_databasename with the correct database name and sqlfilename.sql with the SQL filename you want.)

Press Enter.


Step 5. Enter the password (no. 2 in the image above). Your screen may not show the information so make sure that you are typing the correct information. Take note that password is case sensitive.  Press Enter.

Step 6. To check if the file has been successfully exported use the command(no. 3 in the image above).

ls -alh

This should show you the SQL file that has been exported (no. 4 in the image above).

Step 7. Check the content of the file by typing the command:

less sqlfilename.sql

less-command-ssh mysqldump-ssh

Do not hesitate to contact our support team if you have further questions.

Export MySQL database using SSH

(Visited 228 times, 1 visits today)
Updated on October 19, 2017

Was this article helpful?

Related Articles