Can't connect to MySql database with MySql Workbench

massad 65 Reputation points
2023-10-08T15:52:32.7133333+00:00

I have an Azure Database for MySQL flexible server.

On the Connect tab, I follow the instructions for how to connect from MySql Workbench:

To connect with MySQL workbench client, follow the steps below.

  1. Click the + symbol in the MySQL Connections tab to add a new connection.
  2. Enter a name for the connection in the Connection name field.
  3. Select Standard (TCP/IP) as the Connection Type.
  4. Enter xxx.mysql.database.azure.com in hostname field.
  5. Enter xxx as username and then enter your Password.
  6. Go to the SSL tab and update the Use SSL field to Require.
  7. In the SSL CA File field, enter the file location of the DigiCertGlobalRootCA.crt.pem file.
  8. Click Test Connection to test the connection.
  9. If the connection is successful, click OK to save the connection.

But it doesn't connect. The error is that it can't connect to the host.

I tried setting up a VPN to the Virtual Network but that didn't help.

I started to set up the Firewall on the Virtual Network, but that seemed like a lot of work, so I was hoping to get a confirmation that this works before proceeding. I'm already hours into this :)

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
986 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

Accepted answer
  1. RahulRandive 10,486 Reputation points Volunteer Moderator
    2023-10-08T16:22:38.5366667+00:00

    Hi @massad

    Azure Database for MySQL - Flexible sever supports only one connection option, either public access or private access

    If you are connecting through public access-

    Verify that the client IP address has been added on the server firewall. For purposes of temporary testing only, set up a firewall rule using 0.0.0.0 as the starting IP address and 255.255.255.255 as the ending IP address. This opens the server to all IP addresses. If this resolves the connectivity issue, remove this rule, and then create a firewall rule for an appropriately limited IP address or address range.

    • Ping your server name and make sure that it returns a public IP address. Otherwise, the server should be in a VNet or dropped, or there is a network issue connecting this machine to the internet.
    • Confirm that your network allows outbound connections on port 3306 (this port number can't be changed). Try to telnet to your server to verify the connectivity bu using the following commands:
    • In PowerShell: Test-NetConnection -ComputerName SERVER_NAME -Port 3306
    • In LinuxsShell: telnet SERVER_NAME 3306
    • If you're connecting from an Azure virtual machine, check the network security group (NSG) rules to determine if they're blocking the connection. Also, check the route table to see if there's any VPN device that needs to be configured. For Private access-

    Azure Database for MySQL - Flexible Server integrates with Azure Private DNS zones to provide a reliable, secure DNS service to manage and resolve domain names in a virtual network without the need to add a custom DNS solution. A private DNS zone can be linked to one or more virtual networks by creating virtual network links.

    For such connectivity issue, please follow Troubleshoot connection issues to Azure Database for MySQL - Flexible Server document

     Thank you!

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.