Sunday, March 18, 2018 03:36 am EDT

MySQL Export/Import Command Line Syntax

Bri's picture

If you are like me, occasionally you find yourself working with a database that is so large it's pretty much impossible to do any importing/exporting with the GUI tools. It doesn't happen often enough for myself to have the MySQL commands memorized, so I'm putting them here so I can find them again later.

Exporting using mysqldump

mysqldump –u mysqlUser -p DatabaseName TableName > FilenameToSaveAs 

Importing the same file

mysql –u mysqlUser -p DatabaseName < FilenameToImport 

Examples using Gzip and Gunzip

This example shows dumping the indicators table from the midwest-import database into a Gzipped file called indicators.sql.gz and then importing it back in to a database called midwestfish. Both are using the root mysql user.

mysqldump -u root -p  midwest-import indicators | gzip > indicators.sql.gz

gunzip < indicators.sql.gz | mysql -u root -p midwestfish


Anonymous's picture


Informative college technical process and developing the more and better objectives I ever seen here,thanks. This EssaysVikings blog has been sharing and making the developing the more objectives for the essay methods.

Anonymous's picture

MySQL Export/Import Command Line Syntax

I have got the best updates on export or import command line in mysql. The programming language is very important to all the australianwritingsorg website review writers. So they can manage everything with the following steps.