TutorialsWebsite And Server

Import/Export Mysql Database Using SSH

Import/Export Mysql Database Using SSH

Importing/Exporting MySQL Database using SSH is not a rocket science.

But it is helpful when importing/exporting large databases.

I am posting this because One of our followers Asked Me the question.

Ok, So without wasting time, Let’s start.

Exporting Database to .sql file:

In order to export Database, we’ll gonna use mysqldump command.

To export just login to your SSH client and run following command

mysqldump -u{Sql user} -p{Sql password} {Database} > backup.sql

Chenge Sql username, Sql password and database name with the database you want to export.

After chenging i should looks like mysqldump -uadmin -p1234 admin > backup.sql

It’ll export current database to backup.sql of current directory.

Importing MySQL database:

In order to import Database, Here we’ll use mysql command.

Here we’ll import the Database we just exported.

To import just execute following command.

mysql -u{Sql user} -p{Sql password} {Database} < backup.sql

Similarly change Sql User and Sql password and database name with the database where you want to import.

I know it is a old topic, but hope You found this topic helpful. thank you.

Tags

Related Articles

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Check Also

Close
Close

Adblock Detected

Please consider supporting us by disabling your ad blocker