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
@@ -86,6 +86,10 @@ Except for the databasename, all values are optional. So the minimal DSN is:
86
86
If you do not want to preselect a database, leave `dbname` empty:
87
87
```
88
88
/
89
+
```
90
+
This has the same effect as an empty DSN string:
91
+
```
92
+
89
93
```
90
94
91
95
#### Password
@@ -103,40 +107,140 @@ The functions [net.JoinHostPort](http://golang.org/pkg/net/#JoinHostPort) and [n
103
107
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`.
104
108
105
109
#### Parameters
106
-
***Parameters are case-sensitive!***
107
-
108
-
Possible Parameters are:
109
-
*`allowAllFiles`: `allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files. [*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
110
-
*`allowOldPasswords`: `allowAllFiles=true` allows the usage of the insecure old password method. This should be avoided, but is necessary in some cases. See also [the old_passwords wiki page](https://github.com/go-sql-driver/mysql/wiki/old_passwords).
111
-
*`charset`: Sets the charset used for client-server interaction ("SET NAMES `value`"). If multiple charsets are set (separated by a comma), the following charset is used if setting the charset failes. This enables support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers (`charset=utf8mb4,utf8`).
112
-
*`clientFoundRows`: `clientFoundRows=true` causes an UPDATE to return the number of matching rows instead of the number of rows changed.
113
-
*`loc`: Sets the location for time.Time values (when using `parseTime=true`). The default is `UTC`. *"Local"* sets the system's location. See [time.LoadLocation](http://golang.org/pkg/time/#LoadLocation) for details. 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 `US%2FPacific`.
114
-
*`parseTime`: `parseTime=true` changes the output type of `DATE` and `DATETIME` values to `time.Time` instead of `[]byte` / `string`
115
-
*`strict`: Enable strict mode. MySQL warnings are treated as errors.
116
-
*`timeout`: **Driver** side connection timeout. The value must be a string of decimal numbers, each with optional fraction and a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To set a server side timeout, use the parameter [`wait_timeout`](http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout).
117
-
*`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).
110
+
*Parameters are case-sensitive!*
111
+
112
+
##### `allowAllFiles`
113
+
114
+
```
115
+
Type: bool
116
+
Valid Values: true, false
117
+
Default: false
118
+
```
119
+
120
+
`allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files.
121
+
[*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
122
+
123
+
##### `allowOldPasswords`
124
+
125
+
```
126
+
Type: bool
127
+
Valid Values: true, false
128
+
Default: false
129
+
```
130
+
`allowAllFiles=true` allows the usage of the insecure old password method. This should be avoided, but is necessary in some cases. See also [the old_passwords wiki page](https://github.com/go-sql-driver/mysql/wiki/old_passwords).
131
+
132
+
##### `charset`
133
+
134
+
```
135
+
Type: string
136
+
Valid Values: <name>
137
+
Default: none
138
+
```
139
+
140
+
Sets the charset used for client-server interaction (`"SET NAMES <value>"`). If multiple charsets are set (separated by a comma), the following charset is used if setting the charset failes. This enables support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers (`charset=utf8mb4,utf8`).
141
+
142
+
143
+
##### `clientFoundRows`
144
+
145
+
```
146
+
Type: bool
147
+
Valid Values: true, false
148
+
Default: false
149
+
```
150
+
151
+
`clientFoundRows=true` causes an UPDATE to return the number of matching rows instead of the number of rows changed.
152
+
153
+
154
+
##### `loc`
155
+
156
+
```
157
+
Type: string
158
+
Valid Values: <escaped name>
159
+
Default: UTC
160
+
```
161
+
162
+
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.
163
+
164
+
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`.
165
+
166
+
167
+
##### `parseTime`
168
+
169
+
```
170
+
Type: bool
171
+
Valid Values: true, false
172
+
Default: false
173
+
```
174
+
175
+
`parseTime=true` changes the output type of `DATE` and `DATETIME` values to `time.Time` instead of `[]byte` / `string`
176
+
177
+
178
+
##### `strict`
179
+
180
+
```
181
+
Type: bool
182
+
Valid Values: true, false
183
+
Default: false
184
+
```
185
+
186
+
`strict=true` enables strict mode. MySQL warnings are treated as errors.
187
+
188
+
189
+
##### `timeout`
190
+
191
+
```
192
+
Type: decimal number
193
+
Default: OS default
194
+
```
195
+
196
+
*Driver* side connection timeout. The value must be a string of decimal numbers, each with optional fraction and a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To set a server side timeout, use the parameter [`wait_timeout`](http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout).
197
+
198
+
199
+
##### `tls`
200
+
201
+
```
202
+
Type: bool / string
203
+
Valid Values: true, false, skip-verify, <name>
204
+
Default: false
205
+
```
206
+
207
+
`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).
208
+
209
+
210
+
##### System Variables
118
211
119
212
All other parameters are interpreted as system variables:
0 commit comments