How to Import a Large Database via SSH

How to Import a Large Database via SSH

You need to have:

  • Access to the cPanel of your hosting account.

  • SSH access enabled (if you don't have it, request it from your hosting provider).

  • The .sql backup file already uploaded to the server (via FTP or through the cPanel File Manager).

  • A MySQL user with permissions on the database.


1. Log in to your cPanel
Go to: yourdomain.com/cpanel
Enter your username and password.

2. Create the database and the MySQL user
Inside cPanel:

  • Go to "MySQL Databases".

  • Create a new database.

  • Create a MySQL user (or use an existing one).

  • Link the user to the database and grant all privileges.

Save the following information:

  • Database name (e.g., user_db)

  • Database user (e.g., user_user)

  • Password


3. Upload the .sql file to the server
Use the File Manager in cPanel or an FTP client like FileZilla.

Upload the .sql file to the desired directory, for example: /home/your_user/



4. Access the server via SSH

Use a terminal (on Linux or macOS) or the PuTTY program (on Windows).

Access command:



5. Import the database using the MySQL command
Once connected via SSH, run the following command:
mysql --force -u username -p database_name < file.sql
  • You will be prompted for the MySQL user’s password.

  • The process may take several minutes depending on the size of the file.


6. Verify that the import was successful

Access phpMyAdmin from cPanel.

Open the database and check that the tables and data are present.

    • Related Articles

    • How to import a database in PhpMyAdmin?

      Step 1 1 - In cPanel, go to “PhPMyAdmin”; Step 2 In the top bar of your PHPmyadmin click on "Import"; Click the "Choose File or File" button and select your database (.sql); Step 3 Then correctly define the settings you want for import as in the ...
    • How to import/export a MySQL database

      1 - In cPanel, go to “PhPMyAdmin”; Import: 2 - Click on "Import"; 3 - Click the "Choose File or File" button and select your database (.sql); 4 - Click the "Execute" button; Export: 2 -Choose the database you want to export from the list on the left; ...
    • How to import/export a PostgreSQL database

      Important: First you need to create a PostgreSQL database following this tutorial: https://help.scriptcase.net/portal/pt/kb/articles/banco-de-dados-postgresql 1 - In cPanel, access “phpPgAdmin”; To import: 2 - In the left panel of the screen, click ...
    • How to upload a firebird database to your hosting acount

      If you already have a Firebird database and want to upload it to your hosting account, just follow these steps: Step 1 1. Save/export your local database with the user that accesses your hosting. The password must contain exactly 8 characters, you ...
    • Import a CSV file to MYSQL in PHPMYADMIN

      Step 1 First you must access your cPanel and go to the "phpMyadmin" item in the Database Section; Step 2 - In PHPMyAdmin, go to the menu "Import"; Step 3 - Select CSV format Step 4 - Click "Choose file", and search for local file and select CSV ...