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 14f6e74
Browse filesBrowse the repository at this point in the historyBrowse files
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
+
1056
1193
## Installing
1057
1194
1058
1195
This package is included with WP-CLI itself, no additional installation necessary.
0 commit comments