Export single table MySQL

If you receive the following error:

Error 2020: Got packet bigger than max_allowed_packet bytes when dumping table

This normally occurs as a result of a particular table exceeding the max_allowed_packet size. This can be solved by exporting a single table using:

mysqldump -p --user=username database_name table_name > table_name.sql

You will then be prompted for your MySQL password.

The other option is to simply pass the max_allowed_packet size as an argument to mysqldump as follows:

mysqldump --max_allowed_packet=512M -u username -p database > dumpfile.sql

To import a single table into a MySQL database read here