How to import a database over SSH on cPanel at Hostinger

Import a database over SSH on cPanel at Hostinger for .sql files over 128 MB: upload the file, connect via SSH, and run the mysql command.

Updated 3 weeks ago

Import a database over SSH on cPanel at Hostinger to bring in .sql files larger than phpMyAdmin’s 128 MB limit. Upload the file to public_html, connect via SSH, and run the mysql import command with your database name and username.

Step 1 – Preparation

Step 2 – Connecting via SSH

  • Connect to your hosting via SSH

  • Use the ls command to ensure you are in the root directory, that is, public_html. If you are located in a different directory, use the ls and cd commands to reach it. For example, the process will be similar to this, replacing domain.tld with your domain name:

cd domains
cd domain.tld
cd public_html
  • If the database backup is displayed, go to the next step.

  • If you the backup file is missing, use the File Manager to verify the file is correctly stored in the public_html folder

Step 3 – Import the database

To import the database, use this command:

mysql -u database_username -p database_name < file.sql

If the parameters of your database are:

  • MySQL Database name: user_database

  • MySQL Username: user_admin

  • Uploaded database file: database.sql

The command will look like this:

mysql -u user_admin -p user_database < database.sql

After that you will need to enter the database password – the importing process will start immediately. The import will take some time depending on the size of your database.

When it is completed, a new line will appear:

-bash-4.2$

This line means that the import is complete, and your database tables now appear in phpMyAdmin. For files under 128 MB, you can also import a database with phpMyAdmin.