Dumping specific tables in MySQL using mysqldump

Dumping specific tables in MySQL using mysqldump

For high-traffic websites, I advise developing a stagging website if you make significant updates or even switch the WordPress theme entirely.

But one significant problem I encountered while moving from the staging site to the live one is that all database tables are updated, which could result in financial loss if the website receives multiple orders in a single minute.

To get around this, I first use the mysqldump command to export certain particular tables from the live website, then I push the staging to live and import the previously exported data.

mysqldump -u root yourdatabase -t wp_postmeta -t wp_posts > dump.sql

-t flag specifies tables to export


You can also export all tables and exclude some using the –ignore-table=

For WordPress websites, you can also use WPCLI to export only specific tables.

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.