@@ -227,7 +227,7 @@ Executes an arbitrary SQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
227
227
Exports the database to a file or to STDOUT.
228
228
229
229
~~~
230
- wp db export [<file>] [--<field>=<value>] [--tables=<tables>] [--porcelain]
230
+ wp db export [<file>] [--<field>=<value>] [--tables=<tables>] [--exclude_tables=<tables>] [-- porcelain]
231
231
~~~
232
232
233
233
Runs ` mysqldump ` utility using ` DB_HOST ` , ` DB_NAME ` , ` DB_USER ` and
@@ -244,6 +244,9 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
244
244
[--tables=<tables>]
245
245
The comma separated list of specific tables to export. Excluding this parameter will export all tables in the database.
246
246
247
+ [--exclude_tables=<tables>]
248
+ The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.
249
+
247
250
[--porcelain]
248
251
Output filename for the exported database.
249
252
@@ -265,6 +268,18 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
265
268
$ wp db export --tables=$(wp db tables --all-tables-with-prefix --format=csv)
266
269
Success: Exported to 'wordpress_dbase.sql'.
267
270
271
+ # Skip certain tables from the exported database
272
+ $ wp db export --exclude_tables=wp_options,wp_users
273
+ Success: Exported to 'wordpress_dbase.sql'.
274
+
275
+ # Skip all tables matching a wildcard from the exported database
276
+ $ wp db export --exclude_tables=$(wp db tables 'wp_user*' --format=csv)
277
+ Success: Exported to 'wordpress_dbase.sql'.
278
+
279
+ # Skip all tables matching prefix from the exported database
280
+ $ wp db export --exclude_tables=$(wp db tables --all-tables-with-prefix --format=csv)
281
+ Success: Exported to 'wordpress_dbase.sql'.
282
+
268
283
269
284
270
285
### wp db import
@@ -438,9 +453,11 @@ The size defaults to a human-readable number.
438
453
439
454
## Installing
440
455
441
- Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with ` wp cli update ` .
456
+ This package is included with WP-CLI itself, no additional installation necessary.
457
+
458
+ To install the latest version of this package over what's included in WP-CLI, run:
442
459
443
- Once you've done so, you can install this package with ` wp package install wp-cli/db-command ` .
460
+ wp package install [email protected] : wp-cli/db-command.git
444
461
445
462
## Contributing
446
463
0 commit comments