prisma: Error 28000(9002): SSL Connection is required even when database does not require
Bug description
When a try to introspect a mysql database at azure i receive an error:
Error: Error in connector: Error querying the database: Error querying the database: Error querying the database: Server error: `ERROR 28000 (9002): SSL connection is required. Please specify SSL options and retry. ’
Even when my database has no SSL required. I dont know if it’s because my database is at Azure or my username is something like ‘134@server-221’
How to reproduce
-
With DATABASE_URL: “mysql://username@username:password@server.mysql.database.azure.com:3306/database”
-
Run ‘npx prisma introspect’
-
See error below: Error: Error in connector: Error querying the database: Error querying the database: Error querying the database: Server error: `ERROR 28000 (9002): SSL connection is required. Please specify SSL options and retry. ’
Expected behavior
Generate Entities from the database.
Prisma information
“mysql://username@username:password@server.mysql.database.azure.com:3306/database”
Environment & setup
- OS: [Mac OS, Windows]
- Database: [MySQL]
- Prisma version: 2.0.0-beta.6
- Node.js version: v13.13.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (7 by maintainers)
ref)https://docs.microsoft.com/azure/mysql/concepts-ssl-connection-security
download
https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem
🔐 and save at/prisma
/prisma/prisma.schema
update
/prisma/.env
npx prisma introspect
npx prisma generate
🙆♀️🙆♂️🙆♀️🙆♂️🙆♀️🙆♂️
I faced the same issue and the cert unfortunately didn’t work for me 🤷 Instead I used
?sslaccept=accept_invalid_certs
and worked without the cert@handelcamilo The error is coming the database driver. Can you please make sure that you can connect to your database without ssl from a database GUI or from another driver.