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

Continue with Drizzle ORM

Save the full cheat sheet or work through every related task.

More Drizzle ORM tasks

Back to the full Drizzle ORM cheat sheet