无法使用Mysql转储错误2020导出数据库:

Having trouble creating a database backup on shared hosting where I do not have control over mysql config.

The error I'm receiving is:

mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table `wp_postmeta` at row: 870

Is there a workaround or a script I can use to dump the DB in a more optimal state?

You can increase 'max_allowed_packet' value like this

shell> mysql --max_allowed_packet=512M

For detail info see documentation.