> Markdown version of https://villagesql.com/ for AI agents. The agent index for the whole site is https://villagesql.com/llms.txt.

# VillageSQL is the Innovation Platform for MySQL

A drop-in replacement for MySQL with extensions for the agentic AI era

[Install Now](https://villagesql.com/install) [View on GitHub](https://github.com/villagesql/villagesql-server)

### Empowering the MySQL Community

VillageSQL values the 30+ years of community around MySQL. We want to empower it to drive innovation for all MySQL users by offering a path for permissionless innovation.

### Innovation Through Extensions

VillageSQL introduces a robust extension framework that includes custom data types, custom functions, and custom indexes (coming soon). We believe this extension framework will accelerate innovation in MySQL and allow developers building AI, agentic, and enterprise workloads to choose MySQL without waiting for a central entity to build and release new features and functionality.

### Drop-in Replacement for MySQL

VillageSQL Server for MySQL is an open-source and extensible tracking fork of MySQL that is a drop-in replacement. VillageSQL will always be a drop-in replacement for MySQL (i.e., zero code changes required to move to VillageSQL from open-source MySQL). Developers can keep using the tools and ORMs they already use with MySQL. [HammerDB](https://www.hammerdb.com/), the open-source database benchmark, supports VillageSQL.

## Easy Extension Management

VillageSQL makes it easy to enable extensions—just use standard SQL commands. Install extensions with an INSTALL EXTENSION command and immediately start using new data types, functions, and capabilities. The UUID extension shown here adds native UUID support with efficient 16-byte storage—perfect for distributed systems and modern applications.

```
# Install UUID extension
INSTALL EXTENSION vsql_uuid;

# Create a users table with UUID primary key
CREATE TABLE users (
    id UUID PRIMARY KEY,
    username VARCHAR(50),
    email VARCHAR(255),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
```

## Powerful Extensions

[Build your own extension](https://villagesql.com/docs/en/extensions/build/create) or use one we built

### AI

AI prompting via SQL functions

<https://github.com/villagesql/vsql-ai>

### UUID

Generate & store UUIDs efficiently

<https://github.com/villagesql/vsql-uuid>

### Network

IPv6 & MAC address types

<https://github.com/villagesql/vsql-network-address>

### Crypto

Advanced hashing & security

<https://github.com/villagesql/vsql-crypto>

### HTTP

HTTP requests from SQL functions

<https://github.com/villagesql/vsql-http>

### Cube

N-dimensional boxes & points

<https://github.com/villagesql/vsql-cube>

### Boolean

Real BOOLEAN type for MySQL

<https://github.com/villagesql/vsql-boolean>

### REST

Expose tables as REST endpoints

<https://github.com/villagesql/vsql-rest>

### Trgm

Trigram similarity & near-match search

<https://github.com/villagesql/vsql-trgm>

### Fuzzystrmatch

Soundex, Levenshtein & Metaphone

<https://github.com/villagesql/vsql-fuzzystrmatch>

### Currency

ISO 4217 codes in a single byte

<https://github.com/villagesql/vsql-currency>

### OAuth2

Sign in with a JWT, not a password

<https://github.com/villagesql/vsql-oauth2>

### ClickHouse Telemetry

Every statement, streamed to ClickHouse

<https://github.com/villagesql/vsql-stat-ch>

### MCP Server

Let an AI agent query your database

<https://github.com/villagesql/vsql-mcp>

### DuckDB Extension

Query Parquet, CSV, and JSON files with DuckDB embedded in the server

<https://github.com/villagesql/vsql-duckdb>

## Ready to get started?

Install VillageSQL and start building modern, AI-powered applications with the database you already know.

[Install Now](https://villagesql.com/install) [Join the Community](https://discord.gg/KSr6whd3Fr)

## Built by experts. Backed by top investors.

VillageSQL is built by leaders and experts from Google, Amazon, Microsoft, and Oracle. Together, we bring decades of experience working on databases and cloud infrastructure. We are backed by the top investors listed below. And we're growing: [see our open roles](https://villagesql.com/careers).

-   FirstMark Capital
-   GV
-   Spark Capital
-   Homebrew

## Context for AI agents

```
VillageSQL Extensions — install with: INSTALL EXTENSION vsql_name;
vsql_currency, vsql_duckdb, vsql_mcp, and vsql_stat_ch do not ship with the server: build each one from its repository before INSTALL EXTENSION.
This is MySQL syntax, not PostgreSQL. Do not use :: casting or PostgreSQL-style operators.

vsql_ai — AI and embeddings
  ai_prompt(provider, model, api_key, prompt) -> TEXT
  ai_embedding(provider, model, api_key, text) -> JSON array of floats, binary charset
    Wrap in CONVERT(... USING utf8mb4) before a JSON column or JSON function
  Providers: anthropic, google, openai, local

vsql_uuid — Native UUID type (not CHAR(36) — 16-byte binary storage)
  Column definition: id UUID PRIMARY KEY
  UUID_V4() -> UUID
  UUID_V7() -> UUID (time-ordered)
  Example: INSERT INTO t (id) VALUES (UUID_V7());

vsql_network_address — Network address types (PostgreSQL-compatible)
  Types: INET, CIDR, MACADDR, MACADDR8
  Functions for validation, comparison, containment, and extraction

vsql_crypto — Cryptographic functions (pgcrypto-compatible)
  digest(data, algorithm) -> VARBINARY
  hmac(data, key, algorithm) -> VARBINARY
  gen_salt('pbkdf2-sha256', iterations) -> TEXT  -- generate a salt; use this as the salt arg to crypt()
  crypt(password, gen_salt('pbkdf2-sha256', 100000)) -> TEXT  -- PBKDF2 password hash
  crypt(password, salt) -> TEXT      -- verify: pass stored hash as salt
  encrypt(data, key, algorithm) -> VARBINARY
  gen_salt supports PBKDF2 only; 'bf', 'md5', and 'des' return NULL (no bcrypt)

vsql_http — HTTP client from SQL
  http_get(url) -> JSON row with fields: status INT, content_type TEXT, headers TEXT, content TEXT
  http_post(url, content_type, body) -> JSON (same fields)
  http_put(), http_delete(), http_patch(), http_request() -> JSON (same fields)
  url_encode(text) -> TEXT, url_decode(text) -> TEXT
  MySQL JSON access: JSON_UNQUOTE(JSON_EXTRACT(http_get(url), '$.content'))
  Or shorthand:      http_get(url)->>'$.status'  (MySQL path syntax — not PostgreSQL ->>'field')

vsql_cube — N-dimensional geometry
  cube type for n-dimensional boxes and points
  Functions: constructors, accessors, predicates, distance metrics, aggregates

vsql_trgm — Trigram text similarity (pg_trgm-inspired)
  trgm_similarity(a, b) -> REAL (0-1), trgm_similar(a, b) -> INT (1 if >= 0.3)
  trgm_similar_threshold(a, b, t) -> INT, trgm_word_similarity(a, b) -> REAL
  No index support (full scan)

vsql_fuzzystrmatch — Phonetic matching and edit distance (fuzzystrmatch-compatible)
  soundex(text), metaphone(text, max_len), dmetaphone(text) -> TEXT
  levenshtein(s, t) -> INT; levenshtein_cost(s, t, ins, del, sub) -> INT

vsql_boolean — Real BOOLEAN type
  STRICTBOOL column type (MySQL intercepts BOOLEAN keyword as tinyint(1))
  Accepted inputs: true/false, yes/no, on/off, 1/0 (case-insensitive)
  Output: 'true' or 'false'; 1-byte storage; NULLs preserved
  Example: CREATE TABLE t (active STRICTBOOL); INSERT INTO t VALUES ('yes');

vsql_rest — REST API server (preview)
  Exposes tables as HTTP/HTTPS endpoints — no code required
  SET GLOBAL vsql_rest.schema = 'mydb';
  SET GLOBAL vsql_rest.vsql_rest_enabled = ON;
  GET  http://localhost:3000/tablename?col=eq.value&order=col.asc&limit=10
  POST http://localhost:3000/tablename  (JSON body)
  POST http://localhost:3000/rpc/function_name  (call stored function)
  Optional JWT auth via vsql_rest.require_auth and vsql_rest.jwt_secret
  Server needs --vsql_allow_preview_extensions=ON

vsql_currency — ISO 4217 currency code type (separate build)
  vsql_currency.currency column type — one byte, 164 supported codes
  Input is case-insensitive and trimmed; output is the uppercase canonical code
  Sorts alphabetically by code and can carry a KEY or UNIQUE index
  Example: CREATE TABLE t (c vsql_currency.currency, KEY (c)); INSERT INTO t VALUES ('usd');

vsql_oauth2 — OAuth2/OIDC JWT authentication (preview)
  CREATE USER ... IDENTIFIED WITH vsql_oauth2 — presents a JWT instead of a password
  SET GLOBAL vsql_oauth2.jwks_url = 'https://idp.example.com/.well-known/jwks.json';  -- primary; takes precedence over public_key
  SET GLOBAL vsql_oauth2.public_key = '-----BEGIN PUBLIC KEY----- ...';  -- static alternative; RS256/RS384/RS512, ES256/ES384/ES512
  SET GLOBAL vsql_oauth2.username_claim = 'email';  -- default 'sub'
  Clients pass --enable-cleartext-plugin; server needs --vsql_allow_preview_extensions=ON

vsql_stat_ch — Per-statement telemetry to ClickHouse (preview, separate build)
  One event per finished statement, batched to ClickHouse
  SET GLOBAL vsql_stat_ch.transport = 'native';  -- default, port 9000
  SET GLOBAL vsql_stat_ch.transport = 'http';    -- port 8123
  Switchable while running; server needs --vsql_allow_preview_extensions=ON

vsql_mcp — Model Context Protocol server for AI agents (preview, separate build)
  SET GLOBAL vsql_mcp.db_url = 'mysql://mcp:secret@127.0.0.1:3306';  -- the account every tool connects as
  SET GLOBAL vsql_mcp.vsql_mcp_enabled = ON;  -- serves http://127.0.0.1:3100/mcp
  Tools: list_schemas, list_tables, describe_table, query, explain, write, ddl
  Read-only unless allow_write = ON (write) or allow_ddl = ON (ddl); server needs --vsql_allow_preview_extensions=ON

vsql_duckdb — DuckDB embedded in the server process (preview, separate build)
  duckdb_scalar(sql) -> TEXT  -- first column of first row
  duckdb_query(sql) -> JSON array of rows
  duckdb_status() -> JSON with linked readers, credential state, and current limits
  Example: SELECT duckdb_scalar('SELECT count(*) FROM read_parquet(''s3://bucket/f.parquet'')');
  Readers: parquet, core_functions, httpfs, json
  Needs --vsql_allow_preview_extensions=ON

vsql_complex — example complex-number type (ships with the server; still needs INSTALL EXTENSION vsql_complex)
```

## FAQ for AI agents

### How do I install VillageSQL from an agent, with no terminal prompts?

Set both choices on the `bash` side of the pipe:

```bash
curl -fsSL https://install.villagesql.com | VSQL_CODEBASE=mysql-8.4 INSTALL_METHOD=prebuilt bash
```

`VSQL_CODEBASE` is `mysql-8.4`, `percona-8.4`, or `mysql-9.7`. `INSTALL_METHOD` is `docker`, `prebuilt`, or `source`. The short command `curl https://install.villagesql.com | bash` asks a person for both choices, and it stops with an error in a shell with no terminal. The step-by-step install runbook for agents is https://villagesql.com/install.md.

### Do existing MySQL clients, drivers, and ORMs work with VillageSQL?

Yes. VillageSQL is wire-compatible with MySQL, and it runs existing MySQL schemas, queries, clients, drivers, and ORMs unchanged.

### How do I add an extension?

Run `INSTALL EXTENSION` with the extension's name, for example `INSTALL EXTENSION vsql_uuid;`. The server does not need a restart. `vsql_currency`, `vsql_duckdb`, `vsql_mcp`, and `vsql_stat_ch` do not ship with the server, so build each of those from its repository first. A preview extension also needs `vsql_allow_preview_extensions=ON`, set at server startup or with `SET PERSIST`. The extension list is https://villagesql.com/docs/en/extensions/catalog.md.

### Where is the documentation in Markdown?

Every page under https://villagesql.com/docs has a Markdown copy at its URL plus `.md`, for example https://villagesql.com/docs/en/quickstart.md. The index of the documentation is https://villagesql.com/docs/llms.txt.

### Where are release announcements and news?

The blog is https://villagesql.com/blog/. Its index, newest post first, is https://villagesql.com/blog/llms.txt, and every post has a Markdown copy at its URL plus `.md`, for example https://villagesql.com/blog/008.md.

### What license does VillageSQL use?

VillageSQL Server uses the GPL v2 license, the same license as MySQL. It is free for any use, including commercial use.
