Prisma 7 Adapter Error on MySQL

Auth error: [Error [DriverAdapterError]: pool timeout: failed to retrieve a connection from pool after 10000ms (pool connections: active=0 idle=0 limit=5)] { clientVersion: '7.0.0', [cause]: [Object] } my prisma.ts import { PrismaMariaDb } from '@prisma/adapter-mariadb'; import { PrismaClient } from '@/generated/prisma/client'; const adapter = new PrismaMariaDb({ host: process.env.DATABASE_HOST, user: process.env.DATABASE_USER, password: process.env.DATABASE_PASSWORD, database: process.env.DATABASE_NAME, connectionLimit: 5, }); const prisma = new PrismaClient({ adapter }); export { prisma } How should i setup new prisma 7 with MySQL
No description
3 Replies
Prisma AI Help
You've gone full bot mode! Let me fetch that AI answer for you ASAP. You’re hitting a connection pool timeout: Prisma can’t get a DB connection within 10 seconds, so it throws a DriverAdapterError. [Connection timeout; Pool timeout] With Prisma 7 + @prisma/adapter-mariadb, the key points from the issues/docs are: 1. Adapter must carry the connection info When using the adapter, Prisma does not use DATABASE_URL by default; it defaults to localhost unless you pass host/user/password/etc. into the adapter. [MySQL adapter issue; MySQL adapter example] Your setup already follows the documented pattern:
import { PrismaMariaDb } from '@prisma/adapter-mariadb';
import { PrismaClient } from '@/generated/prisma/client';

const adapter = new PrismaMariaDb({
host: process.env.DATABASE_HOST,
user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_NAME,
port: 3306,
connectionLimit: 5,
});

export const prisma = new PrismaClient({ adapter });

import { PrismaMariaDb } from '@prisma/adapter-mariadb';
import { PrismaClient } from '@/generated/prisma/client';

const adapter = new PrismaMariaDb({
host: process.env.DATABASE_HOST,
user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_NAME,
port: 3306,
connectionLimit: 5,
});

export const prisma = new PrismaClient({ adapter });

2. Check environment variables / connection details In a similar issue, the root cause was mis‑parsed env vars or encoding. Quoting the password and not URI‑encoding it fixed random pool timeouts. [MySQL timeout fix; MySQL URL encoding] Ensure at runtime that the values are non‑empty and correct (e.g. log them without the password). 3. Tune / disable pool timeout if needed The default pool_timeout is 10s. You can increase or disable it via the connection URL, but with the adapter the main control on concurrency is c onnectionLimit. [Pool timeout docs; MySQL options] If, after verifying host/user/password/database and network reachability, you still consistently get active=0 idle=0, that matches the open adapter bug in 7.0.0. [Open adapter issue] In that case, the docs and issues do not yet provide a definitive fix beyond using the explicit adapter config as above, so I can’t reliably suggest more from these sources. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Nurul
Nurul4d ago
Which generator are you using? prisma-client-js or prisma-client?
QTNA
QTNA15h ago
Both generator have same issue

Did you find this page helpful?