Importing a Database via SSH

Cpanel hosting Solution Database Dedicated Server Solution
  1. Make sure you have your database created and a user attached to it. Please remember to copy or write down the information as you will need it in step 5.
  2. Upload your SQL file to the server by either using the File Manager or a FTP Client. It does not matter where you upload it, just remember its location as you will need it later in the steps.
  3. Log into your server via SSH.
  4. Navigate to where you uploaded the .sql file. For example if you uploaded the file to your public_html folder you would run the following command:cd /home/userna5/public_html
  5. Use the command below while replacing userna5_db with your cPanel username and database name, as well as userna5_user with your cPanel user and database user.mysql -p -u userna5_user userna5_db < yoursqlfile.sql 
  6. This will prompt you for a password, here you will enter the password you used when creating the mysql user and attaching it to the database.

Leave a Reply

Your email address will not be published. Required fields are marked *