GoDaddy Help

Export MySQL database in SSH

A Secure Shell (SSH) connection can be used instead of phpMyAdmin to export an SQL backup file for your database. It’s an advanced method that can help when exporting large SQL files and can be necessary when using Self-Managed VPS Hosting since they don’t have phpMyAdmin installed.

Note: If your site is hosted on one of the Managed WordPress hosting plans, you must use WP-CLI instead of SSH.
Required: You'll need the following to complete these steps:
  • An SSH app. We suggest PuTTY for Windows, or Terminal for macOS.
  • Your FTP details. If you don’t have them already written down, you should find your FTP host, username, and password:
  • Your database details. If you don’t have them already written down, you should find your database name, username, hostname, and password:
  1. Connect to my hosting account with SSH (Secure Shell).
  2. Use the command ls to list files and folders, and cd and ../ to move through directories until you are in the directory in which you want to save the backup file.
  3. Connect to MySQL using the following command:
     mysqldump -h hostname -P port -u username -p database > backup.sql
    Note: If you use localhost for your host, you should leave out –h hostname and if you have a standard port (3306) you can leave out –P port part of the command.
    • In the command above, you should replace:
      • hostname with your hostname.
      • port with your MySQL port number. Unless it's specified differently in your hosting account, your port is 3306.
      • username with your username for this database.
      • database with the name of the database you want to export.
      • backup.sql with the name you want to use for the backup file.
  4. Select Enter on your keyboard.
  5. When Enter password: prompt appears, enter your password for that database user.
    Note: The password will not be visible for security reasons, you won’t see anything as you type or paste.
  6. Select Enter on your keyboard.

Your database is exported to the SQL file you named in Step 4 and is ready for you to download to your local computer.

More info

Share this article