mysql

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

What is mysql?

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

Overview of mysql

What it is

Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package. It is a native Go implementation with no C-bindings, providing a lightweight and fast way to connect to MySQL, MariaDB, and TiDB databases from Go applications.

Key features

  • Lightweight and fast, pure Go implementation without C-bindings
  • Supports connections over TCP/IPv4, TCP/IPv6, Unix domain sockets, or custom protocols
  • Automatic handling of broken connections
  • Automatic connection pooling via the database/sql package
  • Supports queries larger than 16MB
  • Secure LOAD DATA LOCAL INFILE support with file allowlisting and io.Reader support

Use cases

This driver is used in any Go application that needs to interact with MySQL, MariaDB, or TiDB databases. Common use cases include web applications, data processing pipelines, and backend services that require reliable database connectivity.

Getting started

Install the driver with:

go get -u github.com/go-sql-driver/mysql

Then use it in your Go code:

import (
	"database/sql"
	_ "github.com/go-sql-driver/mysql"
)

db, err := sql.Open("mysql", "user:password@/dbname")

For full usage details, see the repository README.

License and pricing

This project is licensed under the Mozilla Public License 2.0 (MPL-2.0). It is open source and free to use.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/go-sql-drivermysql.svg)](https://yunodb.com/tools/go-sql-drivermysql?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/go-sql-drivermysql?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/go-sql-drivermysql.svg" alt="Featured on YunoDB" height="20"></a>