MySQL

How to Import Export MySQL database using SSH connection

Commands on Linux to Import/Export MySQL

Frist login to your server using SSH
then you have to run some commands for import/export MySQL database
Note:you need to know the database username and password

to simulate an exmaple lets consider the following:

  • dbusername: cpnluser_user as a database user example, cpnluser as a cPanel username example.
  • dbpassword: mypwd123.
  • dbname: cpnluser_database as database name
  • path to the file: /home/cpnluser/public_html/databases/db_file.sql as location of import/export file path.

Database import

mysql -u cpnluser_user -pmypwd123 cpnluser_database < /home/cpnluser/public_html/databases/db_file.sql
or
mysql -u cpnluser_user -p cpnluser_database < /home/nctests/public_html/cpnluser/db_file.sql
then ssh will ask your for the cpnluser
_user password

Database export

mysqldump -u cpnluser_user -pmypwd123 cpnluser_database > /home/cpnluser/public_html/databases/db_file.sql
or
mysqldump -u cpnluser_user -p cpnluser_database > /home/cpnluser/public_html/databases/db_file.sql
then ssh will ask your for the cpnluser_user password

XsoftHost Support

Share
Tags: LinuxMySQL

Recent Posts

Add Extra IP addresses to server configuration On Ubuntu 17.10 and later

Each failover IP address will need its own line in the configuration file. The configuration…

4 years ago

Create RAID Arrays with mdadm on Ubuntu

What is mdadm? The mdadm utility can be used to create and manage storage arrays…

4 years ago

How to change the maximum upload file size for PHP

There are several scenarios that you might need to increase or decrease your php maximum…

6 years ago

How to install Let’s Encrypt Plugin in WHM/cPanel

What is Let’s Encrypt? Let’s Encrypt is a free certificate authority provided by the Internet…

6 years ago

How to install python in my cPanel and add py extension

Python normally installed on all cPanel hosting server because most of Centos/red hat update system…

6 years ago

How to install and enable GUI GNOME Desktop on centos 7

Usually CentOS 7 comes in a numbers of variants, For most users, there are two…

6 years ago