# brianmario/mysql2

A modern, simple and very fast Mysql library for Ruby - binding to libmysql

Repository: https://github.com/brianmario/mysql2
Canonical: https://ross.abutalabs.com/products/mysql2
Homepage: http://github.com/brianmario/mysql2
Language: Ruby
License: MIT
License Family: permissive
Last push: 2026-08-21T04:49:36+00:00

## Health v2 (maintenance only)
Score: 70/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 98, release rhythm 16, longevity 100
- inputs: {"age_days": 5999, "days_push": 12, "days_rel": 345, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2278, forks 560 (observed 2026-08-28T04:06:33.624101+00:00)

## What it is
A fast, simple MySQL client library for Ruby that binds to libmysqlclient (or MariaDB alternatives). It provides Client, Result, and Statement classes for connecting, querying, and iterating over results with encoding-aware UTF-8 support.

## Use cases
- connect to MySQL from Ruby
- run SQL queries and iterate over results in Ruby
- use prepared statements with MySQL in Ruby
- connect to MariaDB from a Ruby app
- fast MySQL driver for Rails apps

## When to choose
- you need a fast, low-level MySQL/MariaDB driver in Ruby
- you want a simple API for connect-query-iterate without a complex C API mapping
- you need encoding-aware UTF-8 connections

## When to avoid
- you need an ORM or query builder rather than a raw driver
- you use a different database like PostgreSQL
- you need a pure-Ruby driver without native libmysqlclient dependencies

## Facets
- artifact type: library
- maturity: stable
- function: database-driver, database
- domain: databases, backend, web-development
- platform: ruby, windows
- tags: mysql, libmysql, mariadb, gem, prepared-statements, linux, macos

## Member repositories
- brianmario/mysql2 (main) score 70

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:33.624101+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:41:24.872545+00:00, confidence not recorded.
  - readme: https://github.com/brianmario/mysql2 (fetched 2026-08-28T04:06:33.624101+00:00, sha 04e31d701df4)
  - homepage: http://github.com/brianmario/mysql2 (fetched 2026-08-29T10:21:43.541889+00:00, sha 26060bc593b5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
