DEV.co
Open-Source Databases · dolthub

go-mysql-server

go-mysql-server is a MySQL-compatible SQL engine written in Go that lets you query arbitrary data sources using standard SQL. It includes an in-memory database suitable for testing and provides interfaces to implement custom storage backends.

Source: GitHub — github.com/dolthub/go-mysql-server
2.6k
GitHub stars
265
Forks
Go
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorydolthub/go-mysql-server
Ownerdolthub
Primary languageGo
LicenseApache-2.0 — OSI-approved
Stars2.6k
Forks265
Open issues60
Latest releasev0.20.0 (2025-05-13)
Last updated2026-07-07
Sourcehttps://github.com/dolthub/go-mysql-server

What go-mysql-server is

A storage-agnostic SQL query engine implementing MySQL dialect and wire protocol in Go. Features pluggable backend interfaces, built-in memory database for testing, and is used as the foundation for Dolt (a versioned SQL database). Requires C/C++ toolchain and ICU4C for full regex compatibility; pure-Go fallback available with caveats.

Quickstart

Get the go-mysql-server source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/dolthub/go-mysql-server.gitcd go-mysql-server# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

MySQL replacement in Go test suites

Drop-in MySQL mock for unit and integration tests. In-memory backend eliminates setup/teardown overhead and external dependencies.

Custom SQL layer over non-relational backends

Implement storage interfaces to query existing data sources (APIs, document stores, file systems) using standard SQL without building a full database.

Embedded versioned database (via Dolt)

Foundation for Dolt, enabling Git-like version control, branching, and time-travel queries on relational data within applications.

Implementation considerations

  • C/C++ toolchain and libicu-dev required for ICU regex support; compile with `-tags=gms_pure_go` for pure-Go fallback (note: not all tests pass, MySQL compatibility reduced).
  • Custom backend requires implementing core interfaces (Database, Table, Index, etc.) per provided examples. Review Dolt codebase for production-grade reference.
  • In-memory backend suitable only for tests or single-threaded embedded use; confine DDL/DML to one goroutine to avoid data race.
  • Wire protocol compatibility with MySQL clients is strong; test client library against specific MySQL feature set needed (functions, types, edge cases).
  • No native clustering, replication, or high-availability features; rely on custom backend or Dolt for distributed deployments.

When to avoid it — and what to weigh

  • Need production-grade multi-threaded reliability — In-memory database is documented as non-thread-safe; DDL/DML must be confined to single goroutine. Risk of data corruption under concurrent load.
  • Require ACID transactions — No transaction support. START TRANSACTION, COMMIT, and ROLLBACK are no-ops. In-memory backend unsuitable for workloads needing atomicity guarantees.
  • Expecting high-performance indexes — Index implementation performs full table scans rather than optimized lookups. Not suitable for large datasets or join-heavy queries without custom backend.
  • Building production database from scratch — Engine is feature-complete but backend implementations require significant engineering. Use Dolt or managed MySQL for production unless custom backend aligns with architecture.

License & commercial use

Apache License 2.0 (Apache-2.0). Permissive OSI-approved license permitting commercial use, modification, and distribution with liability/warranty disclaimers and license/change notice requirements.

Apache-2.0 explicitly permits commercial use. However, any production deployment should review: (1) liability disclaimers in LICENSE file, (2) compliance with derivative work attribution, (3) obligations if distributing modified versions. For risk-critical systems, legal review recommended. Dolt is the reference production implementation; consider whether to use go-mysql-server directly or via Dolt.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

Inherited security posture depends on backend implementation. In-memory backend has no persistent data protection. Wire protocol follows MySQL conventions; standard SQL injection, auth, and credential management practices apply. No built-in encryption at rest or in transit; implement TLS at network layer if needed. Non-thread-safe in-memory implementation creates data race risk if misused. Audit custom backend implementations for auth/access control.

Alternatives to consider

TestContainers / Docker MySQL

Full MySQL container for tests avoids custom integration but requires Docker/container runtime and slower startup. Better MySQL fidelity; worse developer experience than in-memory.

Dolt

Built on go-mysql-server; adds versioning, branching, and merging. Use if Git-like data versioning is a requirement; otherwise go-mysql-server alone is lighter.

SQLite (with go-sqlite3)

Simpler embedded SQL engine with fewer dependencies; no need for C/C++ toolchain or ICU. Lacks MySQL compatibility and pluggable backend design; use if MySQL dialect not required.

Software development agency

Build on go-mysql-server with DEV.co software developers

Evaluate go-mysql-server for test environments or custom backends. Need production versioning? Explore Dolt. Let's architect the right database layer for your needs.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

go-mysql-server FAQ

Can I use go-mysql-server in production?
As a library, yes. But the in-memory backend is test-only. For production, either implement a custom backend (high engineering cost) or use Dolt as the backend. Review Dolt's production readiness separately.
Do I need ICU4C installed?
Required for full MySQL regex compatibility. Optional if you compile with `-tags=gms_pure_go`, but pure-Go regex lacks full MySQL compatibility and some tests fail. Recommended: install libicu-dev for production use.
Can I query multiple backends simultaneously?
Not natively. go-mysql-server routes queries to a single backend provider. Cross-backend joins require custom implementation or federation logic in your backend layer.
Is it thread-safe?
In-memory database is documented as non-thread-safe. Confine DDL/DML to a single goroutine. Custom backends must implement their own concurrency guarantees.

Custom software development services

DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If go-mysql-server is part of your open-source databases roadmap, our team can implement, customize, migrate, and maintain it.

Ready to add SQL to your Go application?

Evaluate go-mysql-server for test environments or custom backends. Need production versioning? Explore Dolt. Let's architect the right database layer for your needs.