Skip to content

Commit abc2cd9

Browse files
Regenerate README file
1 parent 07cbfce commit abc2cd9

1 file changed

Lines changed: 135 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,141 @@ wp db columns <table> [--format]
10391039
| comment_count | bigint(20) | NO | | 0 | |
10401040
+-----------------------+---------------------+------+-----+---------------------+----------------+
10411041

1042+
1043+
1044+
### wp db status
1045+
1046+
Displays an overview of the database.
1047+
1048+
~~~
1049+
wp db status [--dbuser=<value>] [--dbpass=<value>] [--skip-check] [--format=<format>] [--defaults]
1050+
~~~
1051+
1052+
Shows the database name, the number of tables and their total size, the
1053+
table prefix, the storage engine, character set and collation of the
1054+
tables, and whether `mysqlcheck` reports any problems. Engine, charset
1055+
and collation read "Mixed" when the tables don't all share the same one.
1056+
1057+
Unlike `wp db size` or `wp db prefix`, this doesn't load WordPress, so it
1058+
also works before WordPress is installed.
1059+
1060+
For SQLite databases, the engine is reported as SQLite, and charset,
1061+
collation and check status are not available.
1062+
1063+
**OPTIONS**
1064+
1065+
[--dbuser=<value>]
1066+
Username to pass to mysql and mysqlcheck. Defaults to DB_USER.
1067+
1068+
[--dbpass=<value>]
1069+
Password to pass to mysql and mysqlcheck. Defaults to DB_PASSWORD.
1070+
1071+
[--skip-check]
1072+
Don't run `mysqlcheck`, which reads every table and can take a while on large databases.
1073+
1074+
[--format=<format>]
1075+
Render output in a particular format. The JSON output lists the total size in bytes.
1076+
---
1077+
default: list
1078+
options:
1079+
- list
1080+
- json
1081+
---
1082+
1083+
[--defaults]
1084+
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
1085+
1086+
**EXAMPLES**
1087+
1088+
$ wp db status
1089+
Database Name: wordpress_dbase
1090+
Tables: 12
1091+
Total Size: 868.35 KB
1092+
Prefix: wp_
1093+
Engine: InnoDB
1094+
Charset: utf8mb4
1095+
Collation: utf8mb4_unicode_520_ci
1096+
Check Status: OK
1097+
1098+
$ wp db status --skip-check --format=json
1099+
{"database":"wordpress_dbase","tables":12,"size":868352,"prefix":"wp_","engine":"InnoDB","charset":"utf8mb4","collation":"utf8mb4_unicode_520_ci","check":"Skipped"}
1100+
1101+
1102+
1103+
### wp db users
1104+
1105+
Manages MySQL and MariaDB user accounts.
1106+
1107+
~~~
1108+
wp db users
1109+
~~~
1110+
1111+
Creating users needs a database account with the `CREATE USER` privilege
1112+
(and `GRANT OPTION` for `--grant-privileges`), which the one in wp-config.php
1113+
usually doesn't have. Pass a privileged account with `--dbuser` and `--dbpass`.
1114+
1115+
**EXAMPLES**
1116+
1117+
# Create a user with full privileges on the WordPress database, prompting for both passwords.
1118+
$ wp db users create appuser localhost --grant-privileges --dbuser=root --prompt=dbpass
1119+
1/1 [--dbpass=<value>]:
1120+
Password:
1121+
Success: Created database user 'appuser'@'localhost' with all privileges on 'wp_database'.
1122+
1123+
1124+
1125+
1126+
1127+
### wp db users create
1128+
1129+
Creates a database user.
1130+
1131+
~~~
1132+
wp db users create <username> [<host>] [--password=<password>] [--grant-privileges] [--dbuser=<value>] [--dbpass=<value>] [--defaults]
1133+
~~~
1134+
1135+
The statements are sent to the `mysql` client through STDIN, so the new
1136+
user's password doesn't show up in the process list or in `--debug` output.
1137+
1138+
**OPTIONS**
1139+
1140+
<username>
1141+
Name of the user to create.
1142+
1143+
[<host>]
1144+
Host the user is allowed to connect from. Use `%` for any host.
1145+
---
1146+
default: localhost
1147+
---
1148+
1149+
[--password=<password>]
1150+
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.
1151+
1152+
[--grant-privileges]
1153+
Grant the new user all privileges on the WordPress database (DB_NAME).
1154+
1155+
[--dbuser=<value>]
1156+
Username to connect as. Needs the `CREATE USER` privilege. Defaults to DB_USER.
1157+
1158+
[--dbpass=<value>]
1159+
Password to connect with. Defaults to DB_PASSWORD.
1160+
1161+
[--defaults]
1162+
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
1163+
1164+
**EXAMPLES**
1165+
1166+
# Create a user that can connect from any host, reading its password from a file.
1167+
# This connects as DB_USER, which then needs the CREATE USER privilege.
1168+
$ wp db users create appuser '%' < password.txt
1169+
Success: Created database user 'appuser'@'%'.
1170+
1171+
# Create a user with full privileges on the WordPress database.
1172+
$ wp db users create appuser localhost --grant-privileges --dbuser=root --prompt=dbpass
1173+
1/1 [--dbpass=<value>]:
1174+
Password:
1175+
Success: Created database user 'appuser'@'localhost' with all privileges on 'wp_database'.
1176+
10421177
## Installing
10431178

10441179
This package is included with WP-CLI itself, no additional installation necessary.

0 commit comments

Comments
 (0)