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 4f7635d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -338,7 +338,7 @@ wp db cli [--database=<database>] [--default-character-set=<character-set>] [--d
338
338
Executes a SQL query against the database.
339
339
340
340
~~~
341
-
wp db query [<sql>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--defaults]
341
+
wp db query [<sql>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--defaults] [--skip-sql-mode-compat]
342
342
~~~
343
343
344
344
Executes an arbitrary SQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
@@ -365,6 +365,13 @@ entirely.
365
365
[--defaults]
366
366
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
367
367
368
+
[--skip-sql-mode-compat]
369
+
Run the query under the server's own SQL modes instead of adapting them to
370
+
be WordPress-compatible. By default, the incompatible modes that WordPress
371
+
disables in `wpdb` (such as `NO_ZERO_DATE` and `STRICT_TRANS_TABLES`) are
372
+
stripped for the session, so statements against WordPress's zero-date schema
373
+
behave the same as they do in WordPress itself.
374
+
368
375
**EXAMPLES**
369
376
370
377
# Execute a query stored in a file
@@ -523,7 +530,7 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
523
530
Imports a database from a file or from STDIN.
524
531
525
532
~~~
526
-
wp db import [<file>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--skip-optimization] [--defaults]
533
+
wp db import [<file>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--skip-optimization] [--skip-sql-mode-compat] [--defaults]
527
534
~~~
528
535
529
536
Runs SQL queries using `DB_HOST`, `DB_NAME`, `DB_USER` and
@@ -548,6 +555,9 @@ defined in the SQL.
548
555
[--skip-optimization]
549
556
When using an SQL file, do not include speed optimization such as disabling auto-commit and key checks.
550
557
558
+
[--skip-sql-mode-compat]
559
+
Do not adapt the session SQL mode for WordPress compatibility. By default, `wp db import` strips the SQL modes that WordPress Core disables (such as `STRICT_TRANS_TABLES` and `NO_ZERO_DATE`) so that dumps containing legacy values like `0000-00-00` import cleanly. Pass this flag to import under the server's own SQL modes instead.
560
+
551
561
[--defaults]
552
562
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
0 commit comments