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 or Dedicated Servers since they don’t have phpMyAdmin installed.

Required: You'll need the following to complete these steps:
Note: If you use WordPress, you can find the database details in your wp-config.php file.
  1. Connect to your server or shared hosting account with SSH.
  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 now exported to the SQL file you named in step 4 and is ready for you to download to your local computer.

More info