Manage Azure Database for MySQL
Scale compute and storage
Adjust the compute tier or storage size to match workload demands without downtime.
Via Azure portal
- Navigate to Azure portal >
Azure Database for MySQL> your server. - Select Scale from the left menu.
- Choose a new
Compute tieror updateStorage (GiB). - Click Save. The change is applied within minutes.
Via Azure CLI
az mysql server update \
--resource-group MyResourceGroup \
--name myserver \
--sku-name GP_Gen5_2 \
--storage-size 512
Manage backups
Azure Database for MySQL provides automatic backups. You can configure retention and perform point‑in‑time restores.
Configure backup retention
az mysql server update \
--resource-group MyResourceGroup \
--name myserver \
--backup-retention 14
Point‑in‑time restore
- In the portal, open the server and select Restore.
- Choose a restore point (date & time) and a target server name.
- Click OK to start the restore operation.
Configure high availability
Enable the built‑in high availability (HA) option for minimal downtime.
az mysql server update \
--resource-group MyResourceGroup \
--name myserver \
--high-availability Enabled
Security and networking
Configure firewall rules
az mysql server firewall-rule create \
--resource-group MyResourceGroup \
--server myserver \
--name AllowMyIP \
--start-ip-address 203.0.113.5 \
--end-ip-address 203.0.113.5
Use Azure AD authentication
Enable Azure AD authentication to manage database users with Azure AD identities.
az mysql server ad-admin create \
--resource-group MyResourceGroup \
--server-name myserver \
--display-name myadmin \
--object-id 00000000-0000-0000-0000-000000000000
Monitoring and diagnostics
- Enable Log Analytics workspace to collect query performance metrics.
- Use Azure Monitor alerts for CPU, storage, or connection thresholds.
az monitor metrics alert create \
--name HighCPUAlert \
--resource-group MyResourceGroup \
--scopes /subscriptions/xxxx/resourceGroups/MyResourceGroup/providers/Microsoft.DBforMySQL/servers/myserver \
--condition "max percentage_cpu > 80" \
--action-group MyActionGroup
Delete a server
When a server is no longer required, delete it to stop billing.
az mysql server delete \
--resource-group MyResourceGroup \
--name myserver \
--yes