How can I import a database using SSH?

Home » Knowledge Base » F.A.Q. » Database Management » How can I import a database using SSH?

You need to create an SSH account from your Control Panel > Hosting Tools > SSH Manager section.

Your database backup/dump can be imported using your configured SSH account by executing the following command through SSH:

mysql -h [DB HOSTNAME] -u [DB USERNAME] -p[DB PASSWORD] [DB NAME] < /home/www/database.sql

All the database settings – [DB HOST], [DB USER], [DB PASS], and [DB NAME] should be written exactly as they are displayed in your Hosting Control Panel > Database Manager section.

The dump file should be uploaded into your hosting account and the path /home/www/database.sql may vary depending on the place you uploaded the dump of your database. For example, if you have uploaded your MySQL dump file at /home/www/yourdomain.ext/backups/database.sql you should edit the command to look like this:

MySQL -h [DB HOSTNAME] -u [DB USERNAME] -p[DB PASSWORD] [DB NAME] < /home/www/yourdomain.ext/backups/database.sql

Note: You should make some slight modifications to your database.sql file prior to the import. You need to remove the CREATE DATABASE and USE commands at the first lines of your database.sql file. The lines in question are shown below:

−− CREATE DATABASE ‘username_db’ DEFAULT CHARACTER SET XXXX COLLATE XXXX;

−− USE username_db;

Was this post helpful?

i

Relevant tags:

Connect

Latest posts:

How to Fix 301 Error Moved Permanently

The 301 Moved Permanently is an HTTP status code that indicates a permanent relocation of an online resource from a given URL to a new one. More technically, the moved resource has been moved to the new URL specified in the Location header. The HTTP 301 status code is...

How to Fix 307 Temporary Redirect

307 Temporary Redirect is a response HTTP status code that indicates the requested resource has been moved to a different URL for a limited period of time. Unlike a 301 permanent redirect, the 307 Temporary Redirect message indicates that the change is temporary and...

How to Access Crontab Settings

To access the crontab settings, first, you need to log in to your AwardSpace hosting panel. After you have logged in, head to Crontab Settings, located within the Advanced Tools category:   After you click the Crontab Settings icon, a new page should load. Once...

How to Check My Auto Renewals

To check your AwardSpace hosting plan auto-renewals, first log in to the admin dashboard. Then, head to Wallet, within the Orders & Invoices section:   After that, click the Auto Renewals tab, where you can check any relevant information about your hosting...

How to Check My Payment Requests

To check your payment requests, first log in to the AwardSpace hosting panel. Then, head to Wallet within the Orders & Invoices category:   Then, click the Payment Requests tab. There, you can browse all the information you need about your...



Create a website for free!


Free forever

Our Support Team is Here to Help

 

If you need any questions answered, don't hesitate and contact us. Click the button below and follow the instructions. You can expect an answer within an hour.

 

Contact AwardSpace

 

iNewest knowledge base articles

How to Fix 301 Error Moved Permanently

The 301 Moved Permanently is an HTTP status code that indicates a permanent relocation of an online resource from a given URL to a new one. More technically, the moved resource has been moved to the new URL specified in the Location header. The HTTP 301 status code is...

How to Fix 307 Temporary Redirect

307 Temporary Redirect is a response HTTP status code that indicates the requested resource has been moved to a different URL for a limited period of time. Unlike a 301 permanent redirect, the 307 Temporary Redirect message indicates that the change is temporary and...

How to Access Crontab Settings

To access the crontab settings, first, you need to log in to your AwardSpace hosting panel. After you have logged in, head to Crontab Settings, located within the Advanced Tools category:   After you click the Crontab Settings icon, a new page should load. Once...

How to Check My Auto Renewals

To check your AwardSpace hosting plan auto-renewals, first log in to the admin dashboard. Then, head to Wallet, within the Orders & Invoices section:   After that, click the Auto Renewals tab, where you can check any relevant information about your hosting...

How to Check My Payment Requests

To check your payment requests, first log in to the AwardSpace hosting panel. Then, head to Wallet within the Orders & Invoices category:   Then, click the Payment Requests tab. There, you can browse all the information you need about your...

How to Check My Invoices

To check your invoices in AwardSpace, first log in to the hosting panel. From there, head to Invoices within the Orders & Invoices category:   From this place, you can browse order references, payment orders, payment types, order dates, and various...

Even more web tutorials

Check out our web hosting knowledge base and the WordPress tutorials to learn more, and be better prepared for your website creation and maintenance journey.