Skip to content

Commit 68ea39f

Browse files
README: Clarify strict mode (#500)
The strict mode may not be confused with the server-side strict mode set via the sql_mode system variable. Fixes #376 * README: Set strict mode via sql_mode in DSN example
1 parent b81e73c commit 68ea39f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,11 @@ Valid Values: true, false
263263
Default: false
264264
```
265265

266-
`strict=true` enables the strict mode in which MySQL warnings are treated as errors.
266+
`strict=true` enables a driver-side strict mode in which MySQL warnings are treated as errors. This mode should not be used in production as it may lead to data corruption in certain situations.
267267

268-
By default MySQL also treats notes as warnings. Use [`sql_notes=false`](http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sql_notes) to ignore notes. See the [examples](#examples) for an DSN example.
268+
A server-side strict mode, which is safe for production use, can be set via the [`sql_mode`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html) system variable.
269+
270+
By default MySQL also treats notes as warnings. Use [`sql_notes=false`](http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sql_notes) to ignore notes.
269271

270272

271273
##### `timeout`
@@ -331,9 +333,9 @@ root:pw@unix(/tmp/mysql.sock)/myDatabase?loc=Local
331333
user:password@tcp(localhost:5555)/dbname?tls=skip-verify&autocommit=true
332334
```
333335

334-
Use the [strict mode](#strict) but ignore notes:
336+
Treat warnings as errors by setting the system variable [`sql_mode`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html):
335337
```
336-
user:password@/dbname?strict=true&sql_notes=false
338+
user:password@/dbname?sql_mode=TRADITIONAL
337339
```
338340

339341
TCP via IPv6:

0 commit comments

Comments
 (0)