MySQL Setup in Drizzle ORM

From the Drizzle ORM cheat sheet · Database Setup · verified Jul 2026

MySQL Setup

Connect to MySQL using mysql2 driver.

typescript
import { drizzle } from 'drizzle-orm/mysql2';
import * as schema from './schema';

const db = drizzle(process.env.DATABASE_URL!, { schema });
💡 Install: npm i drizzle-orm mysql2
⚡ Use createPool() for connection reuse
📌 MySQL uses mysqlTable instead of pgTable
🟢 Works with PlanetScale serverless driver too
setupmysqlconnection

More Drizzle ORM tasks

Back to the full Drizzle ORM cheat sheet