How do I import a database over SSH on cPanel?

Importing a database over SSH using cPanel


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’ll 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).

Create a new database or clear the one you plan to import into.

Step 2 – Connecting

• Connect to your hosting account via SSH
• Make sure you’re in the correct directory (public_html). To do this, run the command ls. If you’re in a different directory, you’ll use ls and cd commands one by one. For many sites, the path will look like this:



• If the database backup is displayed - great, go to the next step.
• If you do not see the backup files, 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:



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:


After that you’ll 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’s completed, a new line will appear:




This line means that the importing process is completed, you’ll see your database tables in phpMyAdmin


That’s it! Now you know the way to import your MySQL database.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I change a database password on cPanel?

Changing MySQL database password via cPanel You can change your database’s password by...

How can I change my PHP version on cPanel?

Changing PHP version via cPanel Your Hosting Account's PHP version can be changed at any time,...

How can I create a new MySQL database in cPanel?

Creating a new MySQL database at Servers GATE using cPanel   You can easily create a new MySQL...

How can I locate my MySQL database details on cPanel?

Locating your MySQL database details via cPanel You can easily locate your MySQL databases...

How can I set up a redirect on cPanel?

Creating a redirect on cPanel Your hosting redirects can be easily managed with the assistance...