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
Copy file name to clipboardExpand all lines: README.md
+16-27
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
47
47
## Installation
48
48
Simple install the package to your [$GOPATH](https://github.com/golang/go/wiki/GOPATH"GOPATH") with the [go tool](https://golang.org/cmd/go/"go command") from shell:
49
49
```bash
50
-
$ go get github.com/go-sql-driver/mysql
50
+
$ go get -u github.com/go-sql-driver/mysql
51
51
```
52
52
Make sure [Git is installed](https://git-scm.com/downloads) on your machine and in your system's `PATH`.
53
53
@@ -101,7 +101,8 @@ See [net.Dial](https://golang.org/pkg/net/#Dial) for more information which netw
101
101
In general you should use an Unix domain socket if available and TCP otherwise for best performance.
102
102
103
103
#### Address
104
-
For TCP and UDP networks, addresses have the form `host:port`.
104
+
For TCP and UDP networks, addresses have the form `host[:port]`.
105
+
If `port` is omitted, the default port will be used.
105
106
If `host` is a literal IPv6 address, it must be enclosed in square brackets.
106
107
The functions [net.JoinHostPort](https://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](https://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
107
108
@@ -138,9 +139,9 @@ Default: false
138
139
```
139
140
Type: bool
140
141
Valid Values: true, false
141
-
Default: false
142
+
Default: true
142
143
```
143
-
`allowNativePasswords=true` allows the usage of the mysql native password method.
144
+
`allowNativePasswords=false` disallows the usage of MySQL native password method.
144
145
145
146
##### `allowOldPasswords`
146
147
@@ -231,10 +232,10 @@ Please keep in mind, that param values must be [url.QueryEscape](https://golang.
231
232
##### `maxAllowedPacket`
232
233
```
233
234
Type: decimal number
234
-
Default: 0
235
+
Default: 4194304
235
236
```
236
237
237
-
Max packet size allowed in bytes. Use `maxAllowedPacket=0` to automatically fetch the `max_allowed_packet` variable from server.
238
+
Max packet size allowed in bytes. The default value is 4 MiB and should be adjusted to match the server settings. `maxAllowedPacket=0`can be used to automatically fetch the `max_allowed_packet` variable from server*on every connection*.
238
239
239
240
##### `multiStatements`
240
241
@@ -298,20 +299,6 @@ other cases. You should ensure your application will never cause an ERROR 1290
298
299
except for `read-only` mode when enabling this option.
299
300
300
301
301
-
##### `strict`
302
-
303
-
```
304
-
Type: bool
305
-
Valid Values: true, false
306
-
Default: false
307
-
```
308
-
309
-
`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.
310
-
311
-
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.
312
-
313
-
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.
314
-
315
302
##### `timeout`
316
303
317
304
```
@@ -321,6 +308,7 @@ Default: OS default
321
308
322
309
Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
323
310
311
+
324
312
##### `tls`
325
313
326
314
```
@@ -331,6 +319,7 @@ Default: false
331
319
332
320
`tls=true` enables TLS / SSL encrypted connection to the server. Use `skip-verify` if you want to use a self-signed or invalid certificate (server side). Use a custom value registered with [`mysql.RegisterTLSConfig`](https://godoc.org/github.com/go-sql-driver/mysql#RegisterTLSConfig).
333
321
322
+
334
323
##### `writeTimeout`
335
324
336
325
```
@@ -349,9 +338,9 @@ Any other parameters are interpreted as system variables:
* The values for string variables must be quoted with '
341
+
* The values for string variables must be quoted with `'`.
353
342
* The values must also be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed!
354
-
(which implies values of string variables must be wrapped with `%27`)
343
+
(which implies values of string variables must be wrapped with `%27`).
355
344
356
345
Examples:
357
346
*`autocommit=1`: `SET autocommit=1`
@@ -431,7 +420,7 @@ See the [godoc of Go-MySQL-Driver](https://godoc.org/github.com/go-sql-driver/my
431
420
432
421
433
422
### `time.Time` support
434
-
The default internal output type of MySQL `DATE` and `DATETIME` values is `[]byte` which allows you to scan the value into a `[]byte`, `string` or `sql.RawBytes` variable in your programm.
423
+
The default internal output type of MySQL `DATE` and `DATETIME` values is `[]byte` which allows you to scan the value into a `[]byte`, `string` or `sql.RawBytes` variable in your program.
435
424
436
425
However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` variables, which is the logical opposite in Go to `DATE` and `DATETIME` in MySQL. You can do that by changing the internal output type from `[]byte` to `time.Time` with the DSN parameter `parseTime=true`. You can set the default [`time.Time` location](https://golang.org/pkg/time/#Location) with the `loc` DSN parameter.
437
426
@@ -471,13 +460,13 @@ Mozilla summarizes the license scope as follows:
471
460
472
461
473
462
That means:
474
-
* You can **use** the **unchanged** source code both in private and commercially
475
-
* When distributing, you **must publish** the source code of any **changed files** licensed under the MPL 2.0 under a) the MPL 2.0 itself or b) a compatible license (e.g. GPL 3.0 or Apache License 2.0)
476
-
* You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**
463
+
* You can **use** the **unchanged** source code both in private and commercially.
464
+
* When distributing, you **must publish** the source code of any **changed files** licensed under the MPL 2.0 under a) the MPL 2.0 itself or b) a compatible license (e.g. GPL 3.0 or Apache License 2.0).
465
+
* You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**.
477
466
478
467
Please read the [MPL 2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) if you have further questions regarding the license.
479
468
480
-
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE)
469
+
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE).
481
470
482
471

0 commit comments