go-sql-driver/mysql

Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 40 minutes ago
Added to GitGenius on February 18th, 2025
Created on December 9th, 2012
Open Issues & Pull Requests: 72 (+0)
Number of forks: 2,332
Total Stargazers: 15,272 (+0)
Total Subscribers: 398 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 25.7 hours
Mean response time: 508.4 days
90th percentile: 1960.2 days
Tracked items: 99

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 89% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Only 6% of issues opened in the past year have been closed. Three people close 78% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 38
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 1,444 days
Stale 30+ days: 36
Stale 90+ days: 33

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • question (22)
  • database/sql issue (21)
  • enhancement (18)
  • bug (17)
  • waiting for reply (10)
  • invalid (9)
  • help wanted (6)
  • organization (6)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Go MySQL Driver is a MySQL driver implementation for Go's database/sql package, providing native connectivity to MySQL and MariaDB databases. Written entirely in Go without C bindings, it implements Go's database/sql/driver interface, allowing developers to use the standard database/sql API for MySQL operations.

The driver offers lightweight performance through its pure Go implementation and supports multiple connection protocols including TCP/IPv4, TCP/IPv6, Unix domain sockets, and custom protocols via DialFunc. It handles automatic connection pooling through the database/sql package and includes automatic recovery from broken connections. The driver can process queries larger than 16MB and provides full sql.RawBytes support for efficient data handling. It includes intelligent LONG DATA handling in prepared statements and supports zlib compression for network traffic reduction.

Security features are built into the driver's design. It provides secure LOAD DATA LOCAL INFILE support with file allowlisting and io.Reader support, preventing unauthorized file access. The driver supports optional time.Time parsing, optional placeholder interpolation, and various authentication methods including native passwords and cleartext passwords when explicitly enabled. Configuration options allow fine-grained control over connection behavior, including charset and collation settings for proper Unicode support.

Connection management is a key focus area. The driver requires developers to set db.SetConnMaxLifetime() to ensure connections are safely closed before MySQL server, OS, or middleware closes them, with a recommended timeout shorter than five minutes. The db.SetMaxOpenConns() setting is highly recommended to limit connection usage, and db.SetMaxIdleConns() should typically match SetMaxOpenConns() to prevent excessive connection churn. Additional control is available through db.SetConnMaxIdleTime() for more rapid idle connection closure.

The Data Source Name (DSN) format follows a common pattern with optional components for password, protocol, address, and parameters. All values except the database name are optional, allowing flexible configuration from minimal to fully specified connection strings. The driver includes context.Context support and ColumnType support for advanced query operations.

The repository shares contributors with major projects including microsoft/vscode, golang/go, and rust-lang/rust, indicating its importance in the broader Go ecosystem.