Skip to content

Commit bb7d457

Browse files
Regenerate README file (#361)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 15acb52 commit bb7d457

1 file changed

Lines changed: 138 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,9 @@ Runs SQL queries using `DB_HOST`, `DB_NAME`, `DB_USER` and
550550
`DB_PASSWORD` database credentials specified in wp-config.php. This
551551
does not create database by itself and only performs whatever tasks are
552552
defined in the SQL. If MySQL/MariaDB client binaries are not available,
553-
falls back to importing via WordPress's `wpdb`.
553+
falls back to importing via WordPress's `wpdb`. The fallback reads the
554+
whole file into memory, so it is slower and needs more memory than the
555+
client binaries for large imports.
554556

555557
**OPTIONS**
556558

@@ -1053,6 +1055,141 @@ wp db columns <table> [--format]
10531055
| comment_count | bigint(20) | NO | | 0 | |
10541056
+-----------------------+---------------------+------+-----+---------------------+----------------+
10551057

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

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

0 commit comments

Comments
 (0)