Monday, September 26, 2011

MySQL database import-export from Shell

September 2, 2009 by  
Filed under General

2 Comments

The control panels provide GUI for import / export databases. However, it is very easy doing the same from shell.

Exporting Database

mysqldump dbname > exportfile.sql

This will export the database to exportfile.sql.

You can optionally compress the file to save bandwidth during server to server transfer. Run the following command:

gzip exportfile.sql


Database Import

To import a database from an sql dump file run the following command:

mysql dbname < exportfile.sql

This will import the sql instructions in file exportfile.sql into the database.

mysqldump datbasename > databasename.sql

This will export the database to databasename.sql

To import a database from an sql dump file run

GD Star Rating
a WordPress rating system
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

No related posts.

Comments

2 Responses to “MySQL database import-export from Shell”

Trackbacks

Check out what others are saying about this post...
  1. Valuable Internet Information » MySQL database import-export from Shell | Control Panel Blog says:

    [...] Read more here: MySQL database import-export from Shell | Control Panel Blog [...]

    Reply
  2. Valuable Internet Information » MySQL database import-export from Shell | Control Panel Blog says:

    [...] See the original post here: MySQL database import-export from Shell | Control Panel Blog [...]

    Reply


Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
Click here to cancel reply.