Go MySQL Drivers

If you’re interested in Google’s Go programming language, perhaps you aren’t sure what drivers to use for MySQL. The good news is there are excellent drivers for MySQL.


There are several opensource ones on GitHub and elsewhere, but the driver I recommend is https://github.com/go-sql-driver/mysql/. Why?

  • It is pure Go, not a wrapper around a C library, and is liberally licensed.
  • It is high performance. A lot of work has gone into making it avoid allocations and consume minimal CPU.
  • It is an excellent example of idiomatic Go in action. The authors understand how the database/sql package is supposed to be used. Some drivers aren’t written to this standard and are clumsy or don’t take advantage of database/sql.

This is the driver we use at VividCortex in production. We have had no issues with this driver at all. Credit for that should go to three people who’ve put a large amount of work into it: Julien Schmidt, Arne Hormann, and Brad Fitzpatrick. There are more, but those are the key contributors in my opinion.

If you’re curious how to write idiomatic Go code when accessing a database through the database/sql package with this driver, I recommend http://go-database-sql.org/, which has benefited greatly from the same contributors, as well as a variety of community members and experts at VividCortex.

Photo Credit

I'm Baron Schwartz, the founder and CEO of VividCortex. I am the author of High Performance MySQL and lots of open-source software for performance analysis, monitoring, and system administration. I contribute to various database communities such as Oracle, PostgreSQL, Redis and MongoDB. More about me.