All Collections
MySQL databases
Importing database
How to import a database over SSH
How to import a database over SSH
Importing a database via SSH at Hostinger
Updated over a week ago

phpMyAdmin allows you to import databases up to 256 MB (sometimes a little less, if the database has a large number of rows). If importing with phpMyAdmin failed, you can import your database using SSH. Here are the steps:

Step 1 - Preparation

Step 2 - Connecting

Step 3 - Import

If the database is in compressed format (.sql.gz) use the following command to extract it so it's in .sql format:

gzip -d database_name.gz.sql

Make sure to replace database_name with your database's actual name.

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: u123456789_database

  • MySQL Username: u123456789_admin

  • Uploaded database file: database.sql

The command will look like this:

mysql -u u123456789_admin -p u123456789_database < database.sql

After that you will need to enter the database password - the importing process will start immediately. When it is completed, a new line will appear:

-bash-4.2$

Keep in mind that the import will take some time depending on the size of your database.

That’s it! Now you know how to import your MySQL database 😊

Additional resources:

Did this answer your question?