You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4a9e2e5
Browse filesBrowse the repository at this point in the historyBrowse files
Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
447
451
`DB_PASSWORD` database credentials specified in wp-config.php. Accepts any valid [`mysqldump` flags](https://dev.mysql.com/doc/en/mysqldump.html#mysqldump-option-summary).
452
+
Requires `mysqldump` or `mariadb-dump` client binary to be available.
448
453
449
454
**OPTIONS**
450
455
@@ -467,6 +472,10 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
467
472
[--exclude_tables=<tables>]
468
473
The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.
469
474
475
+
[--exclude_tables_data=<tables>]
476
+
The comma separated list of specific tables for which only the structure will be exported. Excluding this parameter will export data for all tables in the export.
477
+
Requires a dump client that supports --ignore-table-data (mariadb-dump from MariaDB 10.1.45, 10.2.32, 10.3.23, 10.4.13, 10.5.3 or later); MySQL's mysqldump does not. Cannot be combined with --tables.
478
+
470
479
[--include-tablespaces]
471
480
Skips adding the default --no-tablespaces option to mysqldump.
472
481
@@ -514,6 +523,10 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
514
523
$ wp db export --exclude_tables=$(wp db tables --all-tables-with-prefix --format=csv)
515
524
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
516
525
526
+
# Skip data of certain tables from the exported database
527
+
$ wp db export --exclude_tables_data=wp_actionscheduler_logs
528
+
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
529
+
517
530
# Export database to STDOUT.
518
531
$ wp db export -
519
532
-- MySQL dump 10.13 Distrib 5.7.19, for osx10.12 (x86_64)
The statements are sent to the `mysql` client through STDIN, so the new
1152
+
user's password doesn't show up in the process list or in `--debug` output.
1153
+
1154
+
**OPTIONS**
1155
+
1156
+
<username>
1157
+
Name of the user to create.
1158
+
1159
+
[<host>]
1160
+
Host the user is allowed to connect from. Use `%` for any host.
1161
+
---
1162
+
default: localhost
1163
+
---
1164
+
1165
+
[--password=<password>]
1166
+
Password for the new user. If omitted, it is read from STDIN when input is piped, and prompted for otherwise. Avoid passing it here on shared systems, as it ends up in the shell history.
1167
+
1168
+
[--grant-privileges]
1169
+
Grant the new user all privileges on the WordPress database (DB_NAME).
1170
+
1171
+
[--dbuser=<value>]
1172
+
Username to connect as. Needs the `CREATE USER` privilege. Defaults to DB_USER.
1173
+
1174
+
[--dbpass=<value>]
1175
+
Password to connect with. Defaults to DB_PASSWORD.
1176
+
1177
+
[--defaults]
1178
+
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
1179
+
1180
+
**EXAMPLES**
1181
+
1182
+
# Create a user that can connect from any host, reading its password from a file.
1183
+
# This connects as DB_USER, which then needs the CREATE USER privilege.
1184
+
$ wp db users create appuser '%' < password.txt
1185
+
Success: Created database user 'appuser'@'%'.
1186
+
1187
+
# Create a user with full privileges on the WordPress database.
1188
+
$ wp db users create appuser localhost --grant-privileges --dbuser=root --prompt=dbpass
1189
+
1/1 [--dbpass=<value>]:
1190
+
Password:
1191
+
Success: Created database user 'appuser'@'localhost' with all privileges on 'wp_database'.
1192
+
1042
1193
## Installing
1043
1194
1044
1195
This package is included with WP-CLI itself, no additional installation necessary.
0 commit comments