Export dump file from MySql

frazman picture frazman · Sep 15, 2011 · Viewed 89.4k times · Source

I want to create a dump file of a table in the database. So database --> king, tablename --> castle So what I want to do is create a dump file.. and then the next part is to import it in my local host. database name --> king_local. Any ideas on how to go about this!! Thanks

Answer

Mohit Jain picture Mohit Jain · Sep 15, 2011

To export:

 mysqldump -u mysql_user -p DATABASE_NAME > backup.sql

To import:

 mysql -u mysql_user -p DATABASE < backup.sql