Bobcares

CPanel Import Database via SSH

PDF Header PDF Footer

Let us discuss the CPanel import database via SSH.

Before we begin the import using mysqldump, we need to make sure we already have a MySQL database and MySQL database user.

As part of our Server Management Services, we assist our customers with several cPanel queries.

Today, let us see how our techs import databases via SSH.

 

CPanel import database via SSH

First and foremost, we can create a MySQL database and database user by accessing, cPanel -> MySQL Databases.

Similarly, prior to importing a database, we have to ensure that the SQL dumps are complete.

There is a quick method to check the SQL file integrity.

To do so, we use the following command to view the starting and ending lines of the dump:

(head;tail) < /$PATH/$TO/$DUMP.sql

Generally, a working example should look like the following.

Suppose the dump file is not properly terminated nor has a proper header. In that case, the file may be incomplete or corrupted.

[root@the ~]$ (head;tail) < /root/test.sql
-- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64)
--
-- Host: localhost Database: cptest_test
-- ------------------------------------------------------
-- Server version 5.7.34

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2021-05-19 21:47:45

Once we finish creating both, we can import the database file with mysqldump command:

mysql -u database_username -p database_name < databasebackupfilename.sql

In most cases, this should resolve the query. However, if you still cannot perform the import, Bobcares is available 24*7.

[Need help? We are one click away]

 

Conclusion

In short, prior to the import, we need to create a MySQL database and database user. In this article, we saw how our Support Techs perform the import for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

GET UP TO 25% OFF

cPanel Support

Spend time on your business, not on your servers.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management & end-user tech support to us, and use that time to focus on the growth and success of your business.

TALK TO US Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!