phpMyAdmin allows you to import databases up to 128 MB; sometimes a little less, when the database has a large number of rows. If importing with phpMyAdmin failed, you can import your database using SSH by following these steps:
Step 1 – Preparation
-
Upload the database file in .sql format to your website’s public_html folder. You can do so via FTP
-
Create a new database or clear the one you plan to import into
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 thels
andcd
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 importing process is done, you will see your database tables in phpMyAdmin.