Dump and restore a single table from .sql

http://stackoverflow.com/questions/6682916/how-to-backup-a-single-table-in-a-mysql-database

Dump a table

mysqldump db_name table_name > table_name.sql

mysqldump -u <db_username> -h <db_host> -p db_name table_name > table_name.sql

Restore

mysql -u <user_name> -p db_name
mysql> source <full_path>/table_name.sql

or in one line

mysql -u username -p db_name < /path/to/table_name.sql

Dump and restore a single table from a compressed (.sql.gz) format

Credit: John McGrath

Dump

mysqldump db_name table_name | gzip > table_name.sql.gz

Restore

gunzip < table_name.sql.gz | mysql -u username -p db_name



Can take a mysql dump of any particular table with any given condition like below

mysqldump -uusername -p -hhost databasename tablename --skip-lock-tables

If we want to add a specific where condition on table then we can use the following command

mysqldump -uusername -p -hhost databasename tablename --where="date=20140501" --skip