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
+14-25Lines changed: 14 additions & 25 deletions
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
@@ -293,20 +294,6 @@ supposed to happen, setting this on some MySQL providers (such as AWS Aurora)
293
294
is safer for failovers.
294
295
295
296
296
-
##### `strict`
297
-
298
-
```
299
-
Type: bool
300
-
Valid Values: true, false
301
-
Default: false
302
-
```
303
-
304
-
`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.
305
-
306
-
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.
307
-
308
-
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.
309
-
310
297
##### `timeout`
311
298
312
299
```
@@ -316,6 +303,7 @@ Default: OS default
316
303
317
304
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"*.
318
305
306
+
319
307
##### `tls`
320
308
321
309
```
@@ -326,6 +314,7 @@ Default: false
326
314
327
315
`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).
328
316
317
+
329
318
##### `writeTimeout`
330
319
331
320
```
@@ -344,9 +333,9 @@ Any other parameters are interpreted as system variables:
* The values for string variables must be quoted with '
336
+
* The values for string variables must be quoted with `'`.
348
337
* The values must also be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed!
349
-
(which implies values of string variables must be wrapped with `%27`)
338
+
(which implies values of string variables must be wrapped with `%27`).
350
339
351
340
Examples:
352
341
*`autocommit=1`: `SET autocommit=1`
@@ -426,7 +415,7 @@ See the [godoc of Go-MySQL-Driver](https://godoc.org/github.com/go-sql-driver/my
426
415
427
416
428
417
### `time.Time` support
429
-
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.
418
+
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.
430
419
431
420
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.
432
421
@@ -466,13 +455,13 @@ Mozilla summarizes the license scope as follows:
466
455
467
456
468
457
That means:
469
-
* You can **use** the **unchanged** source code both in private and commercially
470
-
* 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)
471
-
* You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**
458
+
* You can **use** the **unchanged** source code both in private and commercially.
459
+
* 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).
460
+
* You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**.
472
461
473
462
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.
474
463
475
-
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE)
464
+
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE).
476
465
477
466

0 commit comments