How to Import export MySQL database from command line

advertisement logo

 

This tip would be useful for those who are either making backup of their remote mysql database or moving their web hosting to their provider.

Here’s how to export mysql DB to SQL file using command-line utility :
mysqldump –user=username –password=1234 –databases your_database –opt –quote-names –complete-insert > example.sql

Here’s how to import the SQL back into mysql database :
mysql –user=username –password=1234 –databases your_database –host=mysql_server host

Don’t forget to add your ip address to the list of allowable host on the remote MySQL server!

Bookmark this article
  • NewsVine
  • Netvouz
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Technorati
  • PDF
  • Digg
  • Facebook
  • Twitter
Tags: , , , , , , , , , ,

Keep updated with this website! : Subscribe to your email

Recommended Reading

6 smashing comments for this post.

  1. Jadu Saikia Said:

    Nice one. Thanks.

    //Jadu, unstableme.blogspot.com

  2. vps Said:

    I use it nice article thank you

  3. photo sharing Said:

    I’ve also used

    mysql -u username -p databasename > backup.sql

  4. mybands Said:

    I need try this. This is interesting.

  5. ssk sorular? Said:

    mysql -u username -p databasename > backup.sql

    thanks

  6. Colocation Dedicated Voip Said:

    Thanks a useful document

    Dedicated Colocation Voip Datacenter

Leave a Comment

Subscribe by email

Enter your Email

 

Bad Behavior has blocked 2954 access attempts in the last 7 days.

HostGator coupons mypapit's Profile on Ping.sg