• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H01-Apr-2021-161132

.gitignoreH A D01-Apr-202184 109

AUTHORSH A D01-Apr-20214 KiB118110

CHANGELOG.mdH A D01-Apr-20219.8 KiB233180

LICENSEH A D01-Apr-202116.3 KiB374293

README.mdH A D01-Apr-202122.1 KiB521365

auth.goH A D01-Apr-202110.1 KiB426283

auth_test.goH A D01-Apr-202138.8 KiB1,331979

benchmark_test.goH A D01-Apr-20217.8 KiB375326

buffer.goH A D01-Apr-20214.8 KiB183112

collations.goH A D01-Apr-20218.5 KiB266162

conncheck.goH A D01-Apr-20211.1 KiB5538

conncheck_dummy.goH A D01-Apr-2021505 185

conncheck_test.goH A D01-Apr-2021872 3921

connection.goH A D01-Apr-202113.9 KiB651520

connection_test.goH A D01-Apr-20214.8 KiB204162

connector.goH A D01-Apr-20213.5 KiB147101

connector_test.goH A D01-Apr-2021578 3126

const.goH A D01-Apr-20213.3 KiB175148

driver.goH A D01-Apr-20213.2 KiB10857

driver_test.goH A D01-Apr-202186.1 KiB3,2122,617

dsn.goH A D01-Apr-202114.1 KiB561428

dsn_test.goH A D01-Apr-202114.6 KiB416342

errors.goH A D01-Apr-20212.6 KiB6640

errors_test.goH A D01-Apr-2021989 4325

fields.goH A D01-Apr-20214.6 KiB195171

fuzz.goH A D01-Apr-2021533 2512

go.modH A D01-Apr-202147 42

infile.goH A D01-Apr-20214.5 KiB183124

nulltime.goH A D01-Apr-20211.2 KiB5133

nulltime_go113.goH A D01-Apr-20211.1 KiB416

nulltime_legacy.goH A D01-Apr-20211 KiB409

nulltime_test.goH A D01-Apr-20211.6 KiB6348

packets.goH A D01-Apr-202132.4 KiB1,350915

packets_test.goH A D01-Apr-20218 KiB337260

result.goH A D01-Apr-2021600 2311

rows.goH A D01-Apr-20214.7 KiB224168

statement.goH A D01-Apr-20215.3 KiB221153

statement_test.goH A D01-Apr-20213.3 KiB152114

transaction.goH A D01-Apr-2021729 3220

utils.goH A D01-Apr-202121 KiB869655

utils_test.goH A D01-Apr-202112.4 KiB509459

README.md

1# Go-MySQL-Driver
2
3A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) package
4
5![Go-MySQL-Driver logo](https://raw.github.com/wiki/go-sql-driver/mysql/gomysql_m.png "Golang Gopher holding the MySQL Dolphin")
6
7---------------------------------------
8  * [Features](#features)
9  * [Requirements](#requirements)
10  * [Installation](#installation)
11  * [Usage](#usage)
12    * [DSN (Data Source Name)](#dsn-data-source-name)
13      * [Password](#password)
14      * [Protocol](#protocol)
15      * [Address](#address)
16      * [Parameters](#parameters)
17      * [Examples](#examples)
18    * [Connection pool and timeouts](#connection-pool-and-timeouts)
19    * [context.Context Support](#contextcontext-support)
20    * [ColumnType Support](#columntype-support)
21    * [LOAD DATA LOCAL INFILE support](#load-data-local-infile-support)
22    * [time.Time support](#timetime-support)
23    * [Unicode support](#unicode-support)
24  * [Testing / Development](#testing--development)
25  * [License](#license)
26
27---------------------------------------
28
29## Features
30  * Lightweight and [fast](https://github.com/go-sql-driver/sql-benchmark "golang MySQL-Driver performance")
31  * Native Go implementation. No C-bindings, just pure Go
32  * Connections over TCP/IPv4, TCP/IPv6, Unix domain sockets or [custom protocols](https://godoc.org/github.com/go-sql-driver/mysql#DialFunc)
33  * Automatic handling of broken connections
34  * Automatic Connection Pooling *(by database/sql package)*
35  * Supports queries larger than 16MB
36  * Full [`sql.RawBytes`](https://golang.org/pkg/database/sql/#RawBytes) support.
37  * Intelligent `LONG DATA` handling in prepared statements
38  * Secure `LOAD DATA LOCAL INFILE` support with file allowlisting and `io.Reader` support
39  * Optional `time.Time` parsing
40  * Optional placeholder interpolation
41
42## Requirements
43  * Go 1.10 or higher. We aim to support the 3 latest versions of Go.
44  * MySQL (4.1+), MariaDB, Percona Server, Google CloudSQL or Sphinx (2.2.3+)
45
46---------------------------------------
47
48## Installation
49Simple 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:
50```bash
51$ go get -u github.com/go-sql-driver/mysql
52```
53Make sure [Git is installed](https://git-scm.com/downloads) on your machine and in your system's `PATH`.
54
55## Usage
56_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.
57
58Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name)  as `dataSourceName`:
59
60```go
61import (
62	"database/sql"
63	"time"
64
65	_ "github.com/go-sql-driver/mysql"
66)
67
68// ...
69
70db, err := sql.Open("mysql", "user:password@/dbname")
71if err != nil {
72	panic(err)
73}
74// See "Important settings" section.
75db.SetConnMaxLifetime(time.Minute * 3)
76db.SetMaxOpenConns(10)
77db.SetMaxIdleConns(10)
78```
79
80[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
81
82### Important settings
83
84`db.SetConnMaxLifetime()` is required to ensure connections are closed by the driver safely before connection is closed by MySQL server, OS, or other middlewares. Since some middlewares close idle connections by 5 minutes, we recommend timeout shorter than 5 minutes. This setting helps load balancing and changing system variables too.
85
86`db.SetMaxOpenConns()` is highly recommended to limit the number of connection used by the application. There is no recommended limit number because it depends on application and MySQL server.
87
88`db.SetMaxIdleConns()` is recommended to be set same to (or greater than) `db.SetMaxOpenConns()`. When it is smaller than `SetMaxOpenConns()`, connections can be opened and closed very frequently than you expect. Idle connections can be closed by the `db.SetConnMaxLifetime()`. If you want to close idle connections more rapidly, you can use `db.SetConnMaxIdleTime()` since Go 1.15.
89
90
91### DSN (Data Source Name)
92
93The Data Source Name has a common format, like e.g. [PEAR DB](http://pear.php.net/manual/en/package.database.db.intro-dsn.php) uses it, but without type-prefix (optional parts marked by squared brackets):
94```
95[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]
96```
97
98A DSN in its fullest form:
99```
100username:password@protocol(address)/dbname?param=value
101```
102
103Except for the databasename, all values are optional. So the minimal DSN is:
104```
105/dbname
106```
107
108If you do not want to preselect a database, leave `dbname` empty:
109```
110/
111```
112This has the same effect as an empty DSN string:
113```
114
115```
116
117Alternatively, [Config.FormatDSN](https://godoc.org/github.com/go-sql-driver/mysql#Config.FormatDSN) can be used to create a DSN string by filling a struct.
118
119#### Password
120Passwords can consist of any character. Escaping is **not** necessary.
121
122#### Protocol
123See [net.Dial](https://golang.org/pkg/net/#Dial) for more information which networks are available.
124In general you should use an Unix domain socket if available and TCP otherwise for best performance.
125
126#### Address
127For TCP and UDP networks, addresses have the form `host[:port]`.
128If `port` is omitted, the default port will be used.
129If `host` is a literal IPv6 address, it must be enclosed in square brackets.
130The functions [net.JoinHostPort](https://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](https://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
131
132For 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`.
133
134#### Parameters
135*Parameters are case-sensitive!*
136
137Notice that any of `true`, `TRUE`, `True` or `1` is accepted to stand for a true boolean value. Not surprisingly, false can be specified as any of: `false`, `FALSE`, `False` or `0`.
138
139##### `allowAllFiles`
140
141```
142Type:           bool
143Valid Values:   true, false
144Default:        false
145```
146
147`allowAllFiles=true` disables the file allowlist for `LOAD DATA LOCAL INFILE` and allows *all* files.
148[*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
149
150##### `allowCleartextPasswords`
151
152```
153Type:           bool
154Valid Values:   true, false
155Default:        false
156```
157
158`allowCleartextPasswords=true` allows using the [cleartext client side plugin](https://dev.mysql.com/doc/en/cleartext-pluggable-authentication.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
159
160##### `allowNativePasswords`
161
162```
163Type:           bool
164Valid Values:   true, false
165Default:        true
166```
167`allowNativePasswords=false` disallows the usage of MySQL native password method.
168
169##### `allowOldPasswords`
170
171```
172Type:           bool
173Valid Values:   true, false
174Default:        false
175```
176`allowOldPasswords=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).
177
178##### `charset`
179
180```
181Type:           string
182Valid Values:   <name>
183Default:        none
184```
185
186Sets 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 for example 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`).
187
188Usage of the `charset` parameter is discouraged because it issues additional queries to the server.
189Unless you need the fallback behavior, please use `collation` instead.
190
191##### `checkConnLiveness`
192
193```
194Type:           bool
195Valid Values:   true, false
196Default:        true
197```
198
199On supported platforms connections retrieved from the connection pool are checked for liveness before using them. If the check fails, the respective connection is marked as bad and the query retried with another connection.
200`checkConnLiveness=false` disables this liveness check of connections.
201
202##### `collation`
203
204```
205Type:           string
206Valid Values:   <name>
207Default:        utf8mb4_general_ci
208```
209
210Sets the collation used for client-server interaction on connection. In contrast to `charset`, `collation` does not issue additional queries. If the specified collation is unavailable on the target server, the connection will fail.
211
212A list of valid charsets for a server is retrievable with `SHOW COLLATION`.
213
214The default collation (`utf8mb4_general_ci`) is supported from MySQL 5.5.  You should use an older collation (e.g. `utf8_general_ci`) for older MySQL.
215
216Collations for charset "ucs2", "utf16", "utf16le", and "utf32" can not be used ([ref](https://dev.mysql.com/doc/refman/5.7/en/charset-connection.html#charset-connection-impermissible-client-charset)).
217
218
219##### `clientFoundRows`
220
221```
222Type:           bool
223Valid Values:   true, false
224Default:        false
225```
226
227`clientFoundRows=true` causes an UPDATE to return the number of matching rows instead of the number of rows changed.
228
229##### `columnsWithAlias`
230
231```
232Type:           bool
233Valid Values:   true, false
234Default:        false
235```
236
237When `columnsWithAlias` is true, calls to `sql.Rows.Columns()` will return the table alias and the column name separated by a dot. For example:
238
239```
240SELECT u.id FROM users as u
241```
242
243will return `u.id` instead of just `id` if `columnsWithAlias=true`.
244
245##### `interpolateParams`
246
247```
248Type:           bool
249Valid Values:   true, false
250Default:        false
251```
252
253If `interpolateParams` is true, placeholders (`?`) in calls to `db.Query()` and `db.Exec()` are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with `interpolateParams=false`.
254
255*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are rejected as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!*
256
257##### `loc`
258
259```
260Type:           string
261Valid Values:   <escaped name>
262Default:        UTC
263```
264
265Sets 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.
266
267Note 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.
268
269Please 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`.
270
271##### `maxAllowedPacket`
272```
273Type:          decimal number
274Default:       4194304
275```
276
277Max 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*.
278
279##### `multiStatements`
280
281```
282Type:           bool
283Valid Values:   true, false
284Default:        false
285```
286
287Allow multiple statements in one query. While this allows batch queries, it also greatly increases the risk of SQL injections. Only the result of the first query is returned, all other results are silently discarded.
288
289When `multiStatements` is used, `?` parameters must only be used in the first statement.
290
291##### `parseTime`
292
293```
294Type:           bool
295Valid Values:   true, false
296Default:        false
297```
298
299`parseTime=true` changes the output type of `DATE` and `DATETIME` values to `time.Time` instead of `[]byte` / `string`
300The date or datetime like `0000-00-00 00:00:00` is converted into zero value of `time.Time`.
301
302
303##### `readTimeout`
304
305```
306Type:           duration
307Default:        0
308```
309
310I/O read timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
311
312##### `rejectReadOnly`
313
314```
315Type:           bool
316Valid Values:   true, false
317Default:        false
318```
319
320
321`rejectReadOnly=true` causes the driver to reject read-only connections. This
322is for a possible race condition during an automatic failover, where the mysql
323client gets connected to a read-only replica after the failover.
324
325Note that this should be a fairly rare case, as an automatic failover normally
326happens when the primary is down, and the race condition shouldn't happen
327unless it comes back up online as soon as the failover is kicked off. On the
328other hand, when this happens, a MySQL application can get stuck on a
329read-only connection until restarted. It is however fairly easy to reproduce,
330for example, using a manual failover on AWS Aurora's MySQL-compatible cluster.
331
332If you are not relying on read-only transactions to reject writes that aren't
333supposed to happen, setting this on some MySQL providers (such as AWS Aurora)
334is safer for failovers.
335
336Note that ERROR 1290 can be returned for a `read-only` server and this option will
337cause a retry for that error. However the same error number is used for some
338other cases. You should ensure your application will never cause an ERROR 1290
339except for `read-only` mode when enabling this option.
340
341
342##### `serverPubKey`
343
344```
345Type:           string
346Valid Values:   <name>
347Default:        none
348```
349
350Server public keys can be registered with [`mysql.RegisterServerPubKey`](https://godoc.org/github.com/go-sql-driver/mysql#RegisterServerPubKey), which can then be used by the assigned name in the DSN.
351Public keys are used to transmit encrypted data, e.g. for authentication.
352If the server's public key is known, it should be set manually to avoid expensive and potentially insecure transmissions of the public key from the server to the client each time it is required.
353
354
355##### `timeout`
356
357```
358Type:           duration
359Default:        OS default
360```
361
362Timeout 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"*.
363
364
365##### `tls`
366
367```
368Type:           bool / string
369Valid Values:   true, false, skip-verify, preferred, <name>
370Default:        false
371```
372
373`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) or use `preferred` to use TLS only when advertised by the server. This is similar to `skip-verify`, but additionally allows a fallback to a connection which is not encrypted. Neither `skip-verify` nor `preferred` add any reliable security. You can use a custom TLS config after registering it with [`mysql.RegisterTLSConfig`](https://godoc.org/github.com/go-sql-driver/mysql#RegisterTLSConfig).
374
375
376##### `writeTimeout`
377
378```
379Type:           duration
380Default:        0
381```
382
383I/O write timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
384
385
386##### System Variables
387
388Any other parameters are interpreted as system variables:
389  * `<boolean_var>=<value>`: `SET <boolean_var>=<value>`
390  * `<enum_var>=<value>`: `SET <enum_var>=<value>`
391  * `<string_var>=%27<value>%27`: `SET <string_var>='<value>'`
392
393Rules:
394* The values for string variables must be quoted with `'`.
395* The values must also be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed!
396 (which implies values of string variables must be wrapped with `%27`).
397
398Examples:
399  * `autocommit=1`: `SET autocommit=1`
400  * [`time_zone=%27Europe%2FParis%27`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `SET time_zone='Europe/Paris'`
401  * [`transaction_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_transaction_isolation): `SET transaction_isolation='REPEATABLE-READ'`
402
403
404#### Examples
405```
406user@unix(/path/to/socket)/dbname
407```
408
409```
410root:pw@unix(/tmp/mysql.sock)/myDatabase?loc=Local
411```
412
413```
414user:password@tcp(localhost:5555)/dbname?tls=skip-verify&autocommit=true
415```
416
417Treat warnings as errors by setting the system variable [`sql_mode`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html):
418```
419user:password@/dbname?sql_mode=TRADITIONAL
420```
421
422TCP via IPv6:
423```
424user:password@tcp([de:ad:be:ef::ca:fe]:80)/dbname?timeout=90s&collation=utf8mb4_unicode_ci
425```
426
427TCP on a remote host, e.g. Amazon RDS:
428```
429id:password@tcp(your-amazonaws-uri.com:3306)/dbname
430```
431
432Google Cloud SQL on App Engine:
433```
434user:password@unix(/cloudsql/project-id:region-name:instance-name)/dbname
435```
436
437TCP using default port (3306) on localhost:
438```
439user:password@tcp/dbname?charset=utf8mb4,utf8&sys_var=esc%40ped
440```
441
442Use the default protocol (tcp) and host (localhost:3306):
443```
444user:password@/dbname
445```
446
447No Database preselected:
448```
449user:password@/
450```
451
452
453### Connection pool and timeouts
454The connection pool is managed by Go's database/sql package. For details on how to configure the size of the pool and how long connections stay in the pool see `*DB.SetMaxOpenConns`, `*DB.SetMaxIdleConns`, and `*DB.SetConnMaxLifetime` in the [database/sql documentation](https://golang.org/pkg/database/sql/). The read, write, and dial timeouts for each individual connection are configured with the DSN parameters [`readTimeout`](#readtimeout), [`writeTimeout`](#writetimeout), and [`timeout`](#timeout), respectively.
455
456## `ColumnType` Support
457This driver supports the [`ColumnType` interface](https://golang.org/pkg/database/sql/#ColumnType) introduced in Go 1.8, with the exception of [`ColumnType.Length()`](https://golang.org/pkg/database/sql/#ColumnType.Length), which is currently not supported.
458
459## `context.Context` Support
460Go 1.8 added `database/sql` support for `context.Context`. This driver supports query timeouts and cancellation via contexts.
461See [context support in the database/sql package](https://golang.org/doc/go1.8#database_sql) for more details.
462
463
464### `LOAD DATA LOCAL INFILE` support
465For this feature you need direct access to the package. Therefore you must change the import path (no `_`):
466```go
467import "github.com/go-sql-driver/mysql"
468```
469
470Files must be explicitly allowed by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the allowlist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)).
471
472To 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.
473
474See the [godoc of Go-MySQL-Driver](https://godoc.org/github.com/go-sql-driver/mysql "golang mysql driver documentation") for details.
475
476
477### `time.Time` support
478The 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.
479
480However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` variables, which is the logical equivalent 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.
481
482**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).
483
484
485### Unicode support
486Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default.
487
488Other collations / charsets can be set using the [`collation`](#collation) DSN parameter.
489
490Version 1.0 of the driver recommended adding `&charset=utf8` (alias for `SET NAMES utf8`) to the DSN to enable proper UTF-8 support. This is not necessary anymore. The [`collation`](#collation) parameter should be preferred to set another collation / charset than the default.
491
492See http://dev.mysql.com/doc/refman/8.0/en/charset-unicode.html for more details on MySQL's Unicode support.
493
494## Testing / Development
495To run the driver tests you may need to adjust the configuration. See the [Testing Wiki-Page](https://github.com/go-sql-driver/mysql/wiki/Testing "Testing") for details.
496
497Go-MySQL-Driver is not feature-complete yet. Your help is very appreciated.
498If you want to contribute, you can work on an [open issue](https://github.com/go-sql-driver/mysql/issues?state=open) or review a [pull request](https://github.com/go-sql-driver/mysql/pulls).
499
500See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/.github/CONTRIBUTING.md) for details.
501
502---------------------------------------
503
504## License
505Go-MySQL-Driver is licensed under the [Mozilla Public License Version 2.0](https://raw.github.com/go-sql-driver/mysql/master/LICENSE)
506
507Mozilla summarizes the license scope as follows:
508> MPL: The copyleft applies to any files containing MPLed code.
509
510
511That means:
512  * You can **use** the **unchanged** source code both in private and commercially.
513  * 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).
514  * You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**.
515
516Please read the [MPL 2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) if you have further questions regarding the license.
517
518You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE).
519
520![Go Gopher and MySQL Dolphin](https://raw.github.com/wiki/go-sql-driver/mysql/go-mysql-driver_m.jpg "Golang Gopher transporting the MySQL Dolphin in a wheelbarrow")
521