How to Import or Export MySQL database from SSH

April 14, 2009 · 0 comments

in Secure Shell Access, Web Hosting



Here we provide a tutorial for importing and exporting MySQL database from the SSH environment. To export a database run

mysqldump datbasename > databasename.sql

This will export the database to databasename.sql

To import a database from an sql dump file run

mysql databasename < dumpsqlfilename.sql

This will import the sql file into the database. Once imported you should check to make sure it was correctly imported to do this run

mysql databasename
show tables;

If the you do not see any tables listed then the sql file likely has a USE statement at the top. Edit the sql file with a text editor and comment out the line “USE databasename”. Once commented out attempt to import the data and check the tablesl. That’s all.

Bookmark Post:
  • Digg
  • del.icio.us
  • NewsVine
  • Reddit
  • Slashdot
  • Technorati
  • BlinkList
  • Propeller
  • Spurl
  • StumbleUpon

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post:

Battlefield 3