How to Import export MySQL database from command line

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!