Skip to content

Commit bf0a4e1

Browse files
committed
Update README.md
1 parent 3242e5e commit bf0a4e1

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ A MySQL-Driver for Go's [database/sql](http://golang.org/pkg/database/sql) packa
2828
## Features
2929
* Lightweight and [fast](https://github.com/go-sql-driver/sql-benchmark "golang MySQL-Driver performance")
3030
* Native Go implementation. No C-bindings, just pure Go
31-
* Connections over TCP/IPv4, TCP/IPv6 or Unix Sockets
31+
* Connections over TCP/IPv4, TCP/IPv6 or Unix domain sockets
3232
* Automatic handling of broken connections
33-
* Automatic Connection-Pooling *(by database/sql package)*
33+
* Automatic Connection Pooling *(by database/sql package)*
3434
* Supports queries larger than 16MB
3535
* Intelligent `LONG DATA` handling in prepared statements
3636
* Secure `LOAD DATA LOCAL INFILE` support with file Whitelisting and `io.Reader` support
@@ -49,26 +49,24 @@ $ go get github.com/go-sql-driver/mysql
4949
Make sure [Git is installed](http://git-scm.com/downloads) on your machine and in your system's `PATH`.
5050

5151
## Usage
52-
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface, so all you need to do is to import the driver and open a new database connection with the given driver.
52+
_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.
5353

54-
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`
54+
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
5555
```go
5656
import "database/sql"
5757
import _ "github.com/go-sql-driver/mysql"
5858

5959
db, e := sql.Open("mysql", "user:password@/dbname?charset=utf8")
6060
```
6161

62-
All further methods are listed here: http://golang.org/pkg/database/sql
63-
6462
[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
6563

6664

6765
### DSN (Data Source Name)
6866

6967
The 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):
7068
```
71-
[username[:password]@][protocol[(address)]]/dbname[?param1=value1&paramN=valueN]
69+
[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]
7270
```
7371

7472
A DSN in its fullest form:
@@ -91,29 +89,27 @@ Passwords can consist of any character. Escaping is **not** necessary.
9189

9290
#### Protocol
9391
See [net.Dial](http://golang.org/pkg/net/#Dial) for more information which networks are available.
94-
In general you should use an Unix-socket if available and TCP otherwise for best performance.
92+
In general you should use an Unix domain socket if available and TCP otherwise for best performance.
9593

9694
#### Address
9795
For TCP and UDP networks, addresses have the form `host:port`.
9896
If `host` is a literal IPv6 address, it must be enclosed in square brackets.
9997
The functions [net.JoinHostPort](http://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](http://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
10098

101-
For Unix-sockets the address is the absolute path to the MySQL-Server-socket, e.g. `/var/run/mysqld/mysqld.sock` or `/tmp/mysql.sock`.
99+
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`.
102100

103101
#### Parameters
104102
**Parameters are case-sensitive!**
105103

106104
Possible Parameters are:
107105
* `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).
108-
* `charset`: *"SET NAMES `value`"*. If multiple charsets are set (seperated 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.
106+
* `charset`: Sets the charset used for client-server interaction (*"SET NAMES `value`"*). If multiple charsets are set (seperated 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`).
109107
* `allowAllFiles`: `allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files. *Might be insecure!*
110-
* _(pending)_ <s>`tls`</s>: will enable SSL/TLS-Encryption
111-
* _(pending)_ <s>`compress`</s>: will enable Compression
112108

113109
All other parameters are interpreted as system variables:
114-
* `autocommit`: *"SET autocommit='`value`'"*
115-
* `time_zone`: *"SET time_zone='`value`'"*
116-
* `tx_isolation`: *"SET [tx_isolation](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation)='`value`'"*
110+
* `autocommit`: *"SET autocommit=`value`"*
111+
* `time_zone`: *"SET time_zone=`value`"*
112+
* `tx_isolation`: *"SET [tx_isolation](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation)=`value`"*
117113
* `param`: *"SET `param`=`value`"*
118114

119115
#### Examples

0 commit comments

Comments
 (0)