prisma: Error P1010 when running `npx prisma migrate dev` with mysql
Bug description
npx prisma migrate dev throws a P1010 error User "prisma" was denied access on the database "timetracking".
The user however is correctly set up, i have no problems connecting to the db when using dbeaver. Only prisma migrate is acting strange.
How to reproduce
- Run
npx prisma migrate devin the project folder
Expected behavior
To be able to run npx prisma migrate devwithout P1010 error when the user is having all the right permissions.
Prisma information
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
TrackedTime TrackedTime[]
}
model TrackedTime {
id String @id @default(uuid())
start DateTime @default(now())
end DateTime?
user User @relation(fields: [userId], references: [id])
userId String
}
DATABASE_URL=mysql://prisma:test@localhost:3306/timetracking
Environment & setup
- OS: Ubuntu 22.04 Kernel 6.0.9
- Database: MySQL running as docker container, port 3306 exposed, v8.0.31 or v5.7.40 (makes no difference)
- Node.js version: 18.12.1
Prisma Version
prisma : 4.6.1
@prisma/client : 4.6.1
Current platform : debian-openssl-3.0.x
Query Engine (Node-API) : libquery-engine 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
Migration Engine : migration-engine-cli 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/migration-engine-debian-openssl-3.0.x)
Introspection Engine : introspection-core 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-3.0.x)
Format Binary : prisma-fmt 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-3.0.x)
Format Wasm : @prisma/prisma-fmt-wasm 4.6.1-3.694eea289a8462c80264df36757e4fdc129b1b32
Default Engines Hash : 694eea289a8462c80264df36757e4fdc129b1b32
Studio : 0.476.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 16
Encountered this issue, fixed by proper permissions.
For
mysqluser must haveCREATE, ALTER, DROP, REFERENCES ON *.*ref: prisma docs
I was able to fix the issue by explicitly creating a shadow_db and defining its URL in the the prisma.schema datasource block:
🤷♂️
my app has the same problem on ubuntu 2204
I had same issue but im using Postgres I just have to change username in connection string on ‘user’
Hello,
I’m experiencing the same issue with :
npx prisma db pushworks fine, Prisma client can connect to the database read & write, butnpx prisma migrate devdoesn’t work:It also can create database, as they are visible in adminer :
I’m using this docker container for mariadb :
initdb.sh does :
Hope it helps!
update openssl 3.0 on ubuntu 22.04 ,it is running .thank you very much.