CentosControl PanelCWPLinuxMySQLUbuntuVesta CP

How to import large MySQL database via command line on CWP, VestaCP and Cpanel server

In this tutorial we’ll learn how to import large mysql databases via ssh terminal command line interface. Large mysql database is the issue when you import it via phpMyAdmin and its limit for uploading is lower then your initial mysql db size. In this case we need to import that database via command line – ssh or terminal.

It is always recommended to import database via mysql command line because it is easy and give less overhead like corrupted tables etc.

I always do mysql databases export and import via command line only.

Follow the below commands to import mysql database:

mysql database_name < database.sql

example usage of this command suppose your database name is “blawp_db” and you’ve database backup named “wordpress_cms.sql” uploaded in “/home” dir.

then the command need to be used like :

cd /home
mysql blawp_db < wordpress_cms.sql

if you’ve database archive you need to extract it before importing via upper command :

if your database is archived in zip eg : database.sql.zip

unzip database.sql.zip 

if your database is archived in gzip eg : database.sql.gz

gunzip database.sql.gz 

if gunzip command doesn’t work install the package :-

For RHEL/Centos :

yum -y install gzip gunzip

for Debian/Ubuntu :

apt-get install gzip gunzip

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles

Leave a Reply

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

Back to top button