Unable to connect to mysql flexible server through Vmss.

Hrishikesh Mudaye 0 Reputation points
2024-03-06T14:30:37.48+00:00

How can I establish a connection between my MySQL Flexible Server and VM Scale Set (VMSS)? I'm encountering an issue where I'm unable to connect to the MySQL Flexible Server from my VMSS. The error message I'm receiving is "Unable to connect to MySQL server <server name> (110) error code 2003 (HY000)." Additionally, my VMSS is located in the Southeast Asia region while the MySQL Flexible Server is situated in the Central India region.

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
746 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Oury Ba-MSFT 17,146 Reputation points Microsoft Employee
    2024-03-06T21:34:52.73+00:00

    @Hrishikesh Mudaye

    Thank you for reaching out.

    Since the server is in a virtual network, you can only connect to the server from other Azure services in the same virtual network as the server. The virtual machine must be created in the same region and same subscription. The Linux virtual machine can be used as SSH tunnel to manage your database server.

    See here Connect Azure Database for MySQL - Flexible Server with private access connectivity method

    To establish successful connectivity, ensure that both resources are in the same region. This alignment will help resolve the issue you’re facing.

    If you want to connect to the Azure Database for MySQL flexible server instance from a client that is provisioned in another virtual network from the same region or a different region, you have to link the private DNS zone with the virtual network. See how to link the virtual network documentation.

    https://learn.microsoft.com/en-us/azure/mysql/flexible-server/concepts-networking-vnet#private-dns-zone-and-virtual-network-peering

    Regards,

    Oury