
prisma-database-setup-mysql
✓ Official★ 8by prisma · part of prisma/cursor-plugin
MySQL Setup. Reference when using this Prisma feature.
MySQL Setup. Reference when using this Prisma feature.
Inspect the full instructions your agent will receiveExpandCollapse
This is the exact playbook injected into your agent when the skill activates — shown here so you can audit it before installing. You don't need to read it to use the skill.
by prisma
MySQL Setup. Reference when using this Prisma feature.
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-database-setup-mysql
Download ZIPGitHub8
3. Environment Variable
In .env:
DATABASE_URL="mysql://user:password@localhost:3306/mydb"
Connection String Format
mysql://USER:PASSWORD@HOST:PORT/DATABASE
-
USER: Database user
-
PASSWORD: Password
-
HOST: Hostname
-
PORT: Port (default 3306)
-
DATABASE: Database name
Driver Adapter (Prisma ORM 7 required)
Prisma ORM 7 uses the query compiler by default, so you must use a driver adapter.
Install adapter and driver:
npm install @prisma/adapter-mariadb mariadb
Instantiate Prisma Client with the adapter:
import 'dotenv/config'
import { PrismaClient } from '../generated/client'
import { PrismaMariaDb } from '@prisma/adapter-mariadb'
const adapter = new PrismaMariaDb({
host: 'localhost',
port: 3306,
connectionLimit: 5,
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
database: process.env.MYSQL_DATABASE,
})
const prisma = new PrismaClient({ adapter })
npm install @prisma/adapter-mariadb mariadbRun this in your project — your agent picks the skill up automatically.
MySQL Setup
Configure Prisma with MySQL (or MariaDB).
Prerequisites
-
MySQL or MariaDB database
-
Connection string
1. Schema Configuration
In prisma/schema.prisma:
datasource db {
provider = "mysql"
}
generator client {
provider = "prisma-client"
output = "../generated"
}
2. Config Configuration (v7)
In prisma.config.ts:
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
datasource: {
url: env('DATABASE_URL'),
},
})
PlanetScale Setup
PlanetScale uses MySQL but requires specific settings because it doesn't support foreign key constraints.
In prisma/schema.prisma:
datasource db {
provider = "mysql"
relationMode = "prisma" // Emulate foreign keys in Prisma
}
Common Issues
"Too many connections"
MySQL has a connection limit. Adjust connection pool size in URL:
DATABASE_URL="mysql://...?connection_limit=5"
JSON Support
MySQL 5.7+ supports JSON. MariaDB 10.2+ supports JSON (as an alias for LONGTEXT with check constraints). Prisma handles this, but verify your version.