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
* Full [`sql.RawBytes`](http://golang.org/pkg/database/sql/#RawBytes) support.
33
+
* Full [`sql.RawBytes`](https://golang.org/pkg/database/sql/#RawBytes) support.
34
34
* Intelligent `LONG DATA` handling in prepared statements
35
35
* Secure `LOAD DATA LOCAL INFILE` support with file Whitelisting and `io.Reader` support
36
36
* Optional `time.Time` parsing
@@ -43,14 +43,14 @@ A MySQL-Driver for Go's [database/sql](http://golang.org/pkg/database/sql) packa
43
43
---------------------------------------
44
44
45
45
## Installation
46
-
Simple install the package to your [$GOPATH](http://code.google.com/p/go-wiki/wiki/GOPATH"GOPATH") with the [go tool](http://golang.org/cmd/go/"go command") from shell:
46
+
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:
47
47
```bash
48
48
$ go get github.com/go-sql-driver/mysql
49
49
```
50
-
Make sure [Git is installed](http://git-scm.com/downloads) on your machine and in your system's `PATH`.
50
+
Make sure [Git is installed](https://git-scm.com/downloads) on your machine and in your system's `PATH`.
51
51
52
52
## Usage
53
-
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](http://golang.org/pkg/database/sql) API then.
53
+
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](https://golang.org/pkg/database/sql/) API then.
54
54
55
55
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
Passwords can consist of any character. Escaping is **not** necessary.
96
96
97
97
#### Protocol
98
-
See [net.Dial](http://golang.org/pkg/net/#Dial) for more information which networks are available.
98
+
See [net.Dial](https://golang.org/pkg/net/#Dial) for more information which networks are available.
99
99
In general you should use an Unix domain socket if available and TCP otherwise for best performance.
100
100
101
101
#### Address
102
102
For TCP and UDP networks, addresses have the form `host:port`.
103
103
If `host` is a literal IPv6 address, it must be enclosed in square brackets.
104
-
The functions [net.JoinHostPort](http://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](http://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
104
+
The functions [net.JoinHostPort](https://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](https://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
105
105
106
106
For Unix domain sockets the address is the absolute path to the MySQL-Server-socket, e.g. `/var/run/mysqld/mysqld.sock` or `/tmp/mysql.sock`.
Sets the location for time.Time values (when using `parseTime=true`). *"Local"* sets the system's location. See [time.LoadLocation](http://golang.org/pkg/time/#LoadLocation) for details.
223
+
Sets the location for time.Time values (when using `parseTime=true`). *"Local"* sets the system's location. See [time.LoadLocation](https://golang.org/pkg/time/#LoadLocation) for details.
224
224
225
225
Note that this sets the location for time.Time values but does not change MySQL's [time_zone setting](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html). For that see the [time_zone system variable](#system-variables), which can also be set as a DSN parameter.
226
226
227
-
Please keep in mind, that param values must be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed. Alternatively you can manually replace the `/` with `%2F`. For example `US/Pacific` would be `loc=US%2FPacific`.
227
+
Please keep in mind, that param values must be [url.QueryEscape](https://golang.org/pkg/net/url/#QueryEscape)'ed. Alternatively you can manually replace the `/` with `%2F`. For example `US/Pacific` would be `loc=US%2FPacific`.
`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`](http://godoc.org/github.com/go-sql-driver/mysql#RegisterTLSConfig).
300
+
`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).
301
301
302
302
##### `writeTimeout`
303
303
@@ -390,17 +390,17 @@ Files must be whitelisted by registering them with `mysql.RegisterLocalFile(file
390
390
391
391
To use a `io.Reader` a handler function must be registered with `mysql.RegisterReaderHandler(name, handler)` which returns a `io.Reader` or `io.ReadCloser`. The Reader is available with the filepath `Reader::<name>` then. Choose different names for different handlers and `DeregisterReaderHandler` when you don't need it anymore.
392
392
393
-
See the [godoc of Go-MySQL-Driver](http://godoc.org/github.com/go-sql-driver/mysql"golang mysql driver documentation") for details.
393
+
See the [godoc of Go-MySQL-Driver](https://godoc.org/github.com/go-sql-driver/mysql"golang mysql driver documentation") for details.
394
394
395
395
396
396
### `time.Time` support
397
397
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.
398
398
399
-
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](http://golang.org/pkg/time/#Location) with the `loc` DSN parameter.
399
+
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.
400
400
401
401
**Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes).
402
402
403
-
Alternatively you can use the [`NullTime`](http://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`.
403
+
Alternatively you can use the [`NullTime`](https://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`.
404
404
405
405
406
406
### Unicode support
@@ -435,7 +435,7 @@ That means:
435
435
* 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)
436
436
* You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**
437
437
438
-
Please read the [MPL 2.0 FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html) if you have further questions regarding the license.
438
+
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.
439
439
440
440
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE)
0 commit comments