Go Mysqlpure

MySQL client library written in pure Go / golang.
Alternatives To Go Mysqlpure
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Mysql_async311928a month ago59December 05, 202214apache-2.0Rust
Asyncronous Rust Mysql driver based on Tokio.
Mariadb Connector C249
a day ago16lgpl-2.1C
MariaDB Connector/C is used to connect applications developed in C/C++ to MariaDB and MySQL databases.The client library is LGPL licensed.
5 years ago3mitC++
A C++11 compliant header-only asynchronous MySQL client library based on Asio. Enables you to work with MySQL in both asynchronous and blocking ways.
15 days ago2otherC++
SQuangLe is a C++ API for accessing MySQL servers
9 years ago1otherPython
Go Mysqlpure23
9 years agoJune 03, 20212otherGo
MySQL client library written in pure Go / golang.
11 years ago4bsd-2-clauseErlang
An Erlang Client library for the ThinkGear Socket Protocol
3 years ago77March 04, 20201Python
A light weight python mysql client library.
3 years agolgpl-2.1Erlang
MySQL Client Library for ePHP (Bragful)
Alternatives To Go Mysqlpure
Select To Compare

Alternative Project Comparisons


This driver is only here for historic purposes.

For a more fully fetured mysql driver in go use:


Project Goal

The goal of this project is to implement the MySQL wire protocol in Go, mostly for my own amusement but it might become usable as a client library for other Go projects.

The wire protocol is documented here


  • Most queries work
  • Server side prepared statements work. (With common types)
  • See example/simple.go for simple example
  • See example/prepared.go for example using server side prepared statements

For a more fully fetured mysql driver in go use:



$ go get github.com/thoj/go-mysqlpure


Three first 2 parameters are passed to Dial. Unix socket: net = unix, raddr = path to mysql.sock

dbh, error = mysql.Connect(net, raddr, username, password, database)

Select database

res, err = dbh.Use(database)

Run simple Query. AffectedRows and InsertId is in res

res, err = dbh.Query(sql)

Prepare server side statement

sth, err = dbh.Prepare(<SQL with ? placeholders>)

Execute prepared statement (Only supports string, int, float parameters):

res, err = sth.Execute(parameters ...)

Fetch row from query with result set

row, err = res.FetchRow()

Fetch one row as map[string]string

rowmap = res.FetchRowMap()

Fetch all rows as []map[string]string

rowsmap = res.FetchAllRowMap()


  • Q: I'm getting question marks instead of my Unicode characters
  • A: Run dbh.Query("SET NAMES utf8") before the select query
Popular Mysql Projects
Popular Client Library Projects
Popular Data Storage Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Client Library