I am trying to follow Prisma’s Start from Scratch guide for setting up a relational database with Node.js and MySQL. However, I encountered an error and I cannot connect to the database server.
Here are the details of the error:
- Environment variables loaded from .env
- Prisma schema loaded from prisma/schema.prisma
- Datasource "db": MySQL database "test" at "gateway01.us-east-1.prod.aws.tidbcloud.com"
Error Message:
Error: P1001: Can’t reach database server at gateway01.us-east-1.prod.aws.tidbcloud.com:3306
I have double-checked my configurations and made sure all the necessary information is correct. However, I still cannot establish a connection to the database server.
Can anyone help me troubleshoot this issue or suggest potential solutions? Any insights or pointers would be greatly appreciated. Thank you in advance!
2
Answers
The default port of TiDB is 4000, not 3306.
It seems there may be a network restriction or firewall rule preventing your connection to the MySQL server. You can verify this by using the telnet command with the server’s IP address and port number. If telnet fails to connect, check your network configuration and ensure the correct IP address and port number are used. If the issue persists, provide more details for further assistance. Good luck!