How do I import a cPanel database via SSH?
Posted by Rob R. on 23 May 2012 04:38 PM

Importing large databases is via a web based utility such as; PHPMyAdmin can sometimes prove to be a challenge. However, luckily there are other ways at making the importing process more streamlined. Using the below step-by-step tutorial, you’ll quickly learn how to restore your MySQL database using SSH.

Creating a database within your cPanel Account:

  • Login to your cPanel SDI web hosting account
  • Locate the section titled "Databases" within cPanel
  • Next, click on the "MySQL Databases" icon
  • Create the database under the "Create New Database" section
  • Then, add a new user by using the "Add New User" section
  • Finally, assign the username to your database (set all privileges)

Uploading your .SQL database (via FTP):

  • Connect to your Server
  • Upload the .sql (non-compressed) file into your home directory (/)

How to import the database:

  • Login to SSH (Secure Shell) 

Once logged in, go to the following directory:

# cd /home/<your-account-name-here>/

  • Please replace the text in BOLD with its correct value
  • Next, you'll need to run the following command:

# mysql -u <database_username> -p <database_name> < backup.sql

  • Please replace the text in BOLD with its correct values
  • When ready, simply hit "enter" key to start the import process.  It may take a moment (do not close the window!)
  • You will then be prompted for the database password, enter that in, and hit the "enter" key

If you have any further questions pertaining to your cPanel SDI hosting account, please feel free to get in contact our web hosting support team for additional assitance.

Search the site


Awesome Offer!


Free domain name with each "new" annual hosting package!

Pick from .com .net or .org

Free for as long as you are our guest!

ordernowto start


*free offer will be calculated during the checkout process