DB Connection Failed SQLSTATE[HY000] [2002]

Saurabh Sharma 10 Reputation points
2024-09-17T04:05:43.1833333+00:00

Hello All,

We have azure web app with Linux OS, php 7.4 stack, publish mode is code and we are using default domain over the same. We are trying to connect the same with MYsql flexible server (Business Critical, E2ads_v5, 2 vCores, 16 GiB RAM, 100 GiB storage). We have specify necessary coonection setup over web app environment variable like ssl config & DB connection string. Once we are trying to connect the same we are getting below error.

Error:- DB Connection Failed SQLSTATE[HY000] [2002]

Web App:- In tenant A

Database:- In tenant B

Mode of connectivity:- Vnet Peering & Express route

Connectivity working fine and checked with telnet(kudo console) over port 3306 & tcpping

Looking for urgent support at your end.

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
827 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
930 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Videsh Lingabavan 0 Reputation points
    2024-09-30T09:24:54.83+00:00

    Hi Saurabh,

    I had a similar error with my website and moving to a new flexible server from a single server. We had a configuration file that was pointing to a certificate which works with the old single server. In the azure portal for the flexible server is a section to download the latest root cert. Once I did this and repointed it in my web app, it was able to connect without issue.

    Videsh

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.