phpMyAdmin allows you to import databases up to 128 MB (sometimes a little less, if the database has a lot of rows). If importing with phpMyAdmin failed, you can import your database using SSH. Here are the steps:
Step 1 - Preparation
Upload the database (file in .sql format ) to public_html (you can do it via FTP).
Step 2 - Connecting
Connect to your hosting account via SSH
Make sure you are in the correct directory (public_html). To do this, run the command ls. If you are in a different directory, you can use ls and cd commands one by one. For most sites, the path will look like this:
cd domains
cd domain.com (where domain.com is your domain)
cd public_html
If the database backup is displayed - great, go to the next step.
If you do not see the backup file, double-check with the File Manager if the file is indeed uploaded and placed to the public_html.
Step 3 - Import
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
And the uploaded file is database.sql, then 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 😊
That’s it! Now you know how to import your MySQL database.
NOTES: