Mysql – Dump Just 1 table from SSH

dumpMySQLsql

With this command :

mysqldump -uuser -ppass dbname > 1.sql

You can dump dbname to 1.sql

I want a way to dump and restore just 1 table of dbname from ssh and command line

Best Answer

You can just add a tablename to your command

mysqldump -uuser -ppass dbname tablename >1.sql

To recover

mysql -uuser -ppass -e "create database dbname;"

mysql -uuser -ppass dbname <1.sql

You may want to look at the mysqldump and mysql man pages for further information.