How do I import a cPanel database via SSH?

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.

  • Email, SSL
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How do I export a cPanel database via SSH?

  Export A MySQL Database 1. Using SSH, execute the following...

How do I clear the exim sendmail statistics on CPanel / WHM ?

  If the size of your eximstats database is getting large ( you can check...

Using suPHP

What is suPHP? suPHP is a tool for executing PHP scripts with the permissions of their...