go-mysql-org /go-mysql

a powerful mysql toolset with Go

★ 4,974⑂ 1,097
GoCreated 2014-02-21
4,974
stars
+2+3+4
1,097
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

go-mysql

A pure Go library to handle MySQL network protocol and replication as used by MySQL and MariaDB.

!semver
!example workflow
!gomod version


 Platform Support

As a pure Go library, this project follows Go's minimum requirements.

This library has been tested or deployed on the following operating systems and architectures:

| Operating System | Architecture | Runtime Supported | CI | Notes                                                                                                                          |
|------------------|--------------|-------------------|----|--------------------------------------------------------------------------------------------------------------------------------|
| Linux            | amd64        | ✅                | ✅ | Check GitHub Actions of this project.                                                                                          |
| Linux            | s390x        | ✅                | ✅ | A daily CI runs on an s390x VM, supported by the IBM Z and LinuxONE Community. |
| Linux            | arm64        | ✅                | ✅ | Deployed in a production environment of a user.                                                                                |
| Linux            | arm          | ✅                | ❌ | A test in CI to make sure builds for 32-bits platforms work.                                                                   |
| FreeBSD          | amd64        | ✅                | ❌ | Sporadically tested by developers.                                                                                             |

Other platforms supported by Go may also work, but they have not been verified. Feel free to report your test results.

This library is not compatible with TinyGo.

 Changelog

This library uses Changelog.

---
 Content
 Replication - Process events from a binlog stream.
 Incremental dumping - Sync from MySQL to Redis, Elasticsearch, etc.
 Client - Simple MySQL client.
 Fake server - server side of the MySQL protocol, as library.
 database/sql like driver - An alternative database/sql driver for MySQL.
 Logging - Custom logging options.
 Migration - Information for how to migrate if you used the old location of this project.

 Examples

The cmd directory contains example applications that can be build by running make build in the root of the project. The resulting binaries will be places in bin/.

- go-binlogparser: parses a binlog file at a given offset
- go-canal: streams binlog events from a server to canal
- go-mysqlbinlog: streams binlog events
- go-mysqldump: like mysqldump, but in Go
- go-mysqlserver: fake MySQL server

 Replication

Replication package handles MySQL replication protocol like python-mysql-replication.

You can use it as a MySQL replica to sync binlog from master then do something, like updating cache, etc...

 Optional packet read-ahead

BinlogSyncerConfig.ReadAheadBufferSize defaults to zero (disabled). A positive
value enables the same packet

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON