How to Import a Database Over SSH

Step 1 - Preparations

  • Upload the database to your website's public_html folder – you can do it via FTP or with the File Manager

  • Create a new database or clear the one you plan to import into

  • If you are unsure about the value of your database password, change it

Step 2 - Connecting via SSH

  • Connect to your hosting account via SSH

  • Open your root directory (public_html)

  • If the database backup file is displayed – go to the next step

  • If you do not see the backup file, double-check using the File Manager that the file is indeed uploaded and placed in the public_html folder

The parameters of your database are:

  • MySQL Database name: u123456789_database
  • MySQL Username: u123456789_admin
  • Uploaded database file: database.sql
  • Path to your .sql file: /home/

How to reache to website files with ssh in cyberpanel

$ cd /home/

## compress folder with ssh

$ apt install zip

zip -r wp-content

## extract folder with ss $ unzip

## import databse via ssh

$ mysql -u username -p domain_db1 < /home/

$ mysql -u root mysql> use domain_db1 mysql> source /home/;

## export database via ssh $ mysqldump -u root -p domain_db1 > websitedump.sql

## export multiple databases $ mysqldump -u root -p ---databases domain_db1 domain_db2 domain_db3 > fullwebsitedump.sql


Did you find this article useful?