Database import or export via SSH

Often, it is more convenient to import and export databases not through the phpMyAdmin interface, but using terminal commands, connecting to the server via SSH. This is especially useful when you need to load or unload a large database.

Database import:
1. Pre-upload the database dump file via FTP or through the control panel

2. Connect to the server via SSH and enter the command:

mysql -u db_user -p db_name <db_dump_file.sql

Import to remote server:

mysql -h Server_type -P port -u db_user -p db_name <db_dump_file.sql

Export (create backup):
1. Connect to the server via SSH and enter the command:

mysqldump -u db_user -p db_name> filename.sql

Export from a remote server:

mysqldump -h Server_type -P port -u db_user -p db_name> file_name

A dump of the database named filename.sql will be saved to the root directory

  • 246 Users Found This Useful
Was this answer helpful?

Related Articles

Database creation

Database (DB) - a unified repository of textual information of the site. The database stores...

Restore backup files on your site or database

General informationOn shared hosting DarkHost, backups are created automatically. If you need to...

Creating a Mailbox

The mailbox is intended for receiving and transmitting emails. Each mailbox has an email address...

Remote Access for MySQL Server

IntroductionThe MySQL server has the ability to listen on specific addresses to accept incoming...

Import and Export of Database Data

Data can be imported and exported using a dump. Database dump is a text file that contains the...