How to Import a Large Database via SSH/FTP

If phpMyAdmin fails to import your database—especially for large files over 128 MB—you can use SSH to import it manually. Follow these steps:

Step 1 - Upload the Database File

  1. Ensure your database file is in .sql format.
  2. Upload it to your website’s public_html folder using FTP or the File Manager in cPanel.
  3. If you haven’t already, create a new database in cPanel or clear an existing one.

Step 2 - Connect to Your Server via SSH

  1. Open a terminal and connect to your hosting account using SSH.
  2. Navigate to the public_html directory by running:
    cd public_html
  3. Verify that the database file is present by using:
    ls
    
    If the file is missing, check the File Manager in cPanel to ensure it's uploaded correctly.

Step 3 - Import the Database

Run the following command to import the database:

mysql -u database_username -p database_name < file.sql

For example, if:

  • Database name = user_database
  • Database username = user_admin
  • Uploaded file = database.sql

The command will be:

mysql -u user_admin -p user_database < database.sql

You'll be prompted to enter the database password. Once entered, the import process will begin. The time required depends on the database size.

Step 4 - Confirm Completion

Once the import is finished, you’ll see a new command prompt line:

-bash-4.2$  

This indicates the process is complete. You can now check phpMyAdmin to verify the imported tables.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What database settings do I use for scripts?

Server Hostname: localhost Database Username: <your username>_<database name> e.g....

How do I add a wildcard subdomain for Wordpress MU?

This can be easily done by logging into your cPanel control panel and clicking on "Subdomains"....

Do you support Silverstripe Hosting?

Yes, we run Linux servers designed to run the New Zealand developed Silverstripe application. If...

Strict Standards Errors for PHP

If you are getting errors similar to:Strict Standards: Non-static method JLoader::import() should...

Fix permissions of all directories and files

To change all the directories to 755 (-rwxr-xr-x): find /home/xxx/public_html -type d -exec...