Go MySQL client
Go MySQL client
May 17, 2021
MySQL connections
See also this article for further details.
MySQL Driver configurations
The repository for MySQL driver is https://github.com/go-sql-driver/mysql
DSN parameters
The DSN parameters for timeout is either application layer and TCP layer and they’re on client sides.
- timeout: a dial timeout.
- readTimeout: Used to set timeout for reading data from I/O. This is used for
net.Conn.SetReadDeadline
- writeTimeout: Used to set timeout for writing data from I/O. This is used for
net.Conn.SetWriteDeadline
MySQL server configurations
Even if the client connection is disconnected, queries on MySQL servers can keep running.
On MySQL server side, some configurations like wait_timeout
is used to close a non-interactive “idle” connection.
See this answer, for example.
In order to stop running queries for longer time, max_execution_time
can be used, though it’s only applied to read-only SELECT statements.
See this article for more details.
Last updated on