Jump to content
Sign in to follow this  

How To Import and Export Databases in MySql

Recommended Posts

How to Import and Export Databases


To Export a database, open up terminal, making sure that you are not logged into MySQL and type,

mysqldump -u [username] -p [database name] > [database name].sql
The database that you selected in the command will now be exported to your droplet.


To import a database, first create a new blank database in the MySQL shell to serve as a destination for your data.

CREATE DATABASE newdatabase;

Then log out of the MySQL shell and type the following on the command line:
mysql -u [username] -p newdatabase < [database name].sql


With that, your chosen database has been imported into your destination database in MySQL.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Create New...