MySQL - How to dump and restore a table only?
By default, mysqldump create a backup of an entire database, so if you want to dump a table only, use this command:
mysqldump -h <host> -u <user_name> -p <db_name> <table_name> > file_name.sql
To restore a table:
mysql -u <user_name> -p <db_name> < /path/to/file_name.sql
Or you can use source
:
mysql -u <user_name> -p <db_name>
mysql> source path/to/file_name.sql
Need a good GUI Tool for MySQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.