mcpbeat Sign in

Prisma Database Setup Mysql Skill for Cursor

MySQL Setup. Reference when using this Prisma feature.

622 tokens
context cost
the whole folder, loaded on every use
2
files
instructions only
0
copies elsewhere
how many repositories repackaged it
8
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-database-setup-mysql

What comes with it

107 bytes besides the instruction
metadata.json

The instruction itself

11 sections, as written by the author

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'),
  },
})

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 })

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.

How to use it

Copy the folder

Take prisma/prisma-database-setup-mysql from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference npm. Without those the skill loads but fails at the first command.