How to import and export a mysql database from the command line
By liviu - Posted on May 23rd, 2009
Tagged:
Sometimes you need to use the command line to export or import a mysql database.
Here is how you do it:
mysqldump -u theUser -p theDataBaseName > /path/to/dump/to/export.dump
mysql -u theUser -p theDataBaseName < /path/to/dump/to/import.dump
theUser is your user (usually root)
theDataBaseName is... you guessed it, the database you want to export from or import into
You will be prompted for a password. You could have written the password also after -p but that is a highly insecure way to do it, for several reasons.
Bookmark/Search this post with:
- liviu's blog
- Login or register to post comments
Delicious
Digg
StumbleUpon
Propeller
Reddit
Magnoliacom
Newsvine
Furl
Facebook
Google
Yahoo
Technorati
Icerocket