GoDaddy Довідка

Import MySQL database with SSH

A Secure Shell (SSH) connection can be used instead of phpMyAdmin to import an SQL backup file to your database. It's an advanced method that can help when importing 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. Upload the SQL backup file to the server using FTP or File Manager.
  2. Connect to your server or shared hosting account with SSH.
  3. Use the command ls to list files and folders, and cd and ../ to move through directories until you are in the directory to which you uploaded the backup file.
  4. Connect to MySQL using the following command:
     mysql -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 of your backup file.
  5. Select Enter on your keyboard.
  6. 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.
  7. Select Enter on your keyboard.

The SQL backup file is now imported to your database.

More info