Warning: session_start(): open(/var/cpanel/php/sessions/alt-php74/sess_6dd50c3c0bf9ae9ea04b67ab9089ef5d, O_RDWR) failed: No such file or directory (2) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358

Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/alt-php74) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358
How to Import Export MySQL database using SSH connection - XsoftHost

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

Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

Related Posts