Skip to content

Commit ff5fa14

Browse files
committed
Update README
1 parent 9b08c20 commit ff5fa14

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,29 @@ The connection string has the following syntax:
8686
mysql://[user[:[password]]@]host[:port][/schema][?param1=value1&param2=value2]
8787
```
8888

89-
Connection query params:
89+
#### Transport
9090

91-
- encoding: The collation & charset (character set) to use during the connection.
91+
The driver supports tcp connection or unix sockets
92+
93+
- `mysql://localhost` will connect using tcp and the default MySQL port 3306.
94+
- `mysql://localhost:8088` will connect using tcp using port 8088.
95+
- `mysql:///path/to/other.sock` will connect using unix socket `/path/to/other.sock`.
96+
97+
Any of the above can be used with `user@` or `user:password@` to pass credentials.
98+
99+
#### Default database
100+
101+
A `database` query string will specify the default database.
102+
Connection strings with a host can also use the first path component to specify the default database.
103+
Query string takes presedence because it's more explicit.
104+
105+
- `mysql://localhost/mydb`
106+
- `mysql://localhost:3306/mydb`
107+
- `mysql://localhost:3306?database=mydb`
108+
- `mysql:///path/to/other.sock?database=mydb`
109+
110+
#### Other query params
111+
112+
- `encoding`: The collation & charset (character set) to use during the connection.
92113
If empty or not defined, it will be set to `utf8_general_ci`.
93114
The list of available collations is defined in [`MySql::Collations::COLLATIONS_IDS_BY_NAME`](src/mysql/collations.cr)

0 commit comments

Comments
 (0)