Troubleshooting Azure Database for MySQL

This guide helps you identify and resolve common issues when using Azure Database for MySQL. Use the table of contents to jump to a specific topic.

Table of Contents

Connectivity Issues

Unable to connect to your MySQL server? Verify the following:

Check firewall rules

Ensure that the client IP address is listed in the Allowed IP Addresses section of the server’s networking settings.

az mysql server firewall-rule create \
    --resource-group MyResourceGroup \
    --server myserver \
    --name AllowMyIP \
    --start-ip-address <your_ip> \
    --end-ip-address <your_ip>
Validate SSL settings

Azure Database for MySQL enforces SSL by default. Use the --ssl-mode=REQUIRED flag or configure your client accordingly.

mysql -h myserver.mysql.database.azure.com -u myadmin@myserver -p --ssl-mode=REQUIRED

Performance Degradation

Typical reasons for slow queries include insufficient resources, missing indexes, or high contention.

EXPLAIN SELECT * FROM orders WHERE order_date > '2025-01-01';

Replication & Failover

Azure Database for MySQL provides built‑in high availability. If you encounter replication lag:

  1. Check the Replication Status blade in the portal.
  2. Verify the long_running_queries metric.
  3. Consider enabling Read Replica for off‑loading read traffic.

Security & Authentication

Common authentication problems:

az mysql server admin-login reset \
    --resource-group MyResourceGroup \
    --server myserver \
    --admin-user myadmin \
    --admin-password NewP@ssw0rd!

Backup & Restore Problems

Restores failing due to insufficient compute or storage can be resolved by increasing the GTU tier.

az mysql server restore \
    --resource-group MyResourceGroup \
    --name myrestoredserver \
    --source-server myserver \
    --restore-point-in-time "2025-08-15T12:00:00Z"

FAQ

Why is my connection string failing after a firewall rule change?

Firewalls apply immediately but cached DNS entries may persist for up to 5 minutes. Restart your client or flush DNS.

Can I change the server version?

Yes, upgrade in-place via the portal or CLI. Downgrades are not supported; you must create a new server and migrate data.