Table of Contents
When you are importing a database over 50MB, you will run into the limitation in your PhpMyAdmin that prevents you from importing a database over 50MB. On shared servers you can try installing your own PhpMyAdmin to import it or you will need to contact tech support to import it for you.
This article will explain how to import a database via SSH.
Important! You must first have a database created like the image to the right.
Steps to Import a database through shell
- SSH into your server using the correct steps for your hosting plan – shared or VPS/Dedicated.
- Go to the directory your backup .sql file is located in. For example, if your database backup is named new_databse.sql in your cPanel home directory for userna5, you will change to that directory like the following command.
- Check the directory for your .sql file by typing
ll
. You should see an output similar to below: - Next you can Import the database.
user_name: This is your cPanel username or the database user you created and added to the database.
data_base: This is the name of the database. In this example its userna5_tester.
new_databse.sql: This is the name of the database you want to import into your empty database on your server.The general syntax for the command is as follows:
In this example we will use the cPanel Username. Hit Enter.
- You will be asked to enter your password like the following. Enter the users password. (For the cPanel user you use the cPanel password. If you added a user to the database, you will use that users password.)
When the database is finished you will get the prompt again. Check your database in your cPanel. You should see Megabytes taken in the size column like the image to the right.
This worked well but it does require uploading a sometimes large .sql file to our dedicated server. Would this work if I imported the database directly from our local computer by adding the -h (–host=) option to the mysql command?