Choose the right MySQL Server option in Azure

APPLIES TO: Azure Database for MySQL - Single Server Azure Database for MySQL - Flexible Server

With Azure, your MySQL server workloads can run in a hosted virtual machine infrastructure as a service (IaaS) or as a hosted platform as a service (PaaS). PaaS has two deployment options, and there are service tiers within each deployment option. When you choose between IaaS and PaaS, you must decide if you want to manage your database, apply patches, backups, security, monitoring, scaling or if you want to delegate these operations to Azure.

When making your decision, consider the following two options:

  • Azure Database for MySQL. This option is a fully managed MySQL database engine based on the stable version of MySQL community edition. This relational database as a service (DBaaS), hosted on the Azure cloud platform, falls into the industry category of PaaS. With a managed instance of MySQL on Azure, you can use built-in features viz automated patching, high availability, automated backups, elastic scaling, enterprise grade security, compliance and governance, monitoring and alerting that otherwise require extensive configuration when MySQL Server is either on-premises or in an Azure VM. When using MySQL as a service, you pay-as-you-go, with options to scale up or scale out for greater control with no interruption. Azure Database for MySQL, powered by the MySQL community edition is available in two deployment modes:

    • Flexible Server - Azure Database for MySQL Flexible Server is a fully managed production-ready database service designed for more granular control and flexibility over database management functions and configuration settings. The flexible server architecture allows users to opt for high availability within single availability zone and across multiple availability zones. Flexible servers provides better cost optimization controls with the ability to stop/start server and burstable compute tier, ideal for workloads that do not need full compute capacity continuously. Flexible Server also supports reserved instances allowing you to save up to 63% cost, ideal for production workloads with predictable compute capacity requirements. The service supports community version of MySQL 5.7 and 8.0. The service is generally available today in wide variety of Azure regions. Flexible servers are best suited for all new developments and migration of production workloads to Azure Database for MySQL service.

    • Single Server is a fully managed database service designed for minimal customization. The single server platform is designed to handle most of the database management functions such as patching, backups, high availability, security with minimal user configuration and control. The architecture is optimized for built-in high availability with 99.99% availability on single availability zone. It supports community version of MySQL 5.6 (retired), 5.7 and 8.0. The service is generally available today in wide variety of Azure regions. Single servers are best suited only for existing applications already leveraging single server. For all new developments or migrations, Flexible Server would be the recommended deployment option.

  • MySQL on Azure VMs. This option falls into the industry category of IaaS. With this service, you can run MySQL Server inside a managed virtual machine on the Azure cloud platform. All recent versions and editions of MySQL can be installed in the virtual machine.

Comparing the MySQL deployment options in Azure

The main differences between these options are listed in the following table:

Attribute Azure Database for MySQL
Single Server
Azure Database for MySQL
Flexible Server
MySQL on Azure VMs
General
General availability Generally Available Generally Available Generally Available
Service-level agreement (SLA) 99.99% availability SLA 99.99% using Availability Zones 99.99% using Availability Zones
Underlying O/S Windows Linux User Managed
MySQL Edition Community Edition Community Edition Community or Enterprise Edition
MySQL Version Support 5.6(Retired), 5.7 & 8.0 5.7 & 8.0 Any version
Availability zone selection for application colocation No Yes Yes
Username in connection string <user_name>@server_name. For example, mysqlusr@mypgServer Just username. For example, mysqlusr Just username. For example, mysqlusr
Compute & Storage Scaling
Compute tiers Basic, General Purpose, Memory Optimized Burstable, General Purpose, Memory Optimized Burstable, General Purpose, Memory Optimized
Compute scaling Supported (Scaling from and to Basic tier is not supported) Supported Supported
Storage size 5 GiB to 16 TiB 20 GiB to 16 TiB 32 GiB to 32,767 GiB
Online Storage scaling Supported Supported Not Supported
Auto storage scaling Supported Supported Not Supported
IOPs scaling Not Supported Supported Not Supported
Cost Optimization
Reserved Instance Pricing Supported Supported Supported
Stop/Start Server for development Server can be stopped up to 7 days Server can be stopped up to 30 days Supported
Low cost Burstable SKU Not Supported Supported Supported
Networking/Security
Network Connectivity - Public endpoints with server firewall.
- Private access with Private Link support.
- Public endpoints with server firewall.
- Private access with Virtual Network integration.
- Public endpoints with server firewall.
- Private access with Private Link support.
SSL/TLS Enabled by default with support for TLS v1.2, 1.1 and 1.0 Enabled by default with support for TLS v1.2, 1.1 and 1.0 Supported with TLS v1.2, 1.1 and 1.0
Data Encryption at rest Supported with customer managed keys (BYOK) Supported with service managed keys Not Supported
Azure AD Authentication Supported Not Supported Not Supported
Microsoft Defender for Cloud support Yes No No
Server Audit Supported Supported User Managed
Patching & Maintenance
Operating system patching Automatic Automatic User managed
MySQL minor version upgrade Automatic Automatic User managed
MySQL in-place major version upgrade Supported from 5.6 to 5.7 Not Supported User Managed
Maintenance control System managed Customer managed User managed
Maintenance window Anytime within 15 hrs window 1hr window User managed
Planned maintenance notification 3 days 5 days User managed
High Availability
High availability Built-in HA (without hot standby) Built-in HA (without hot standby), Same-zone and zone-redundant HA with hot standby User managed
Zone redundancy Not supported Supported Supported
Standby zone placement Not supported Supported Supported
Automatic failover Yes (spins another server) Yes User Managed
User initiated Forced failover No Yes User Managed
Transparent Application failover Yes Yes User Managed
Replication
Support for read replicas Yes Yes User Managed
Number of read replicas supported 5 10 User Managed
Mode of replication Asynchronous Asynchronous User Managed
Gtid support for read replicas Supported Supported User Managed
Cross-region support (Geo-replication) Yes Not supported User Managed
Hybrid scenarios Supported with Data-in Replication Supported with Data-in Replication User Managed
Gtid support for data-in replication Supported Supported User Managed
Data-out replication Not Supported In preview Supported
Backup and Recovery
Automated backups Yes Yes No
Backup retention 7-35 days 1-35 days User Managed
Long term retention of backups User Managed User Managed User Managed
Exporting backups Supported using logical backups Supported using logical backups Supported
Point in time restore capability to any time within the retention period Yes Yes User Managed
Fast restore point No Yes No
Ability to restore on a different zone Not supported Yes Yes
Ability to restore to a different VNET No Yes Yes
Ability to restore to a different region Yes (Geo-redundant) Yes (Geo-redundant) User Managed
Ability to restore a deleted server Yes Yes No
Disaster Recovery
DR across Azure regions Using cross region read replicas, geo-redundant backup Using geo-redundant backup User Managed
Automatic failover No Not Supported No
Can use the same r/w endpoint No Not Supported No
Monitoring
Azure Monitor integration & alerting Supported Supported User Managed
Monitoring database operations Supported Supported User Managed
Query Performance Insights Supported Supported (using Workbooks) User Managed
Server Logs Supported Supported (using Diagnostics logs) User Managed
Audit Logs Supported Supported Supported
Error Logs Not Supported Supported Supported
Azure advisor support Supported Not Supported Not Supported
Plugins
validate_password Not Supported In preview Supported
caching_sha2_password Not Supported In preview Supported
Developer Productivity
Fleet Management Supported with Azure CLI, PowerShell, REST, and Azure Resource Manager Supported with Azure CLI, PowerShell, REST, and Azure Resource Manager Supported for VMs with Azure CLI, PowerShell, REST, and Azure Resource Manager
Terraform Support Supported Supported Supported
GitHub Actions Supported Supported User Managed

Business motivations for choosing PaaS or IaaS

There are several factors that can influence your decision to choose PaaS or IaaS to host your MySQL databases.

Cost

Cost reduction is often the primary consideration that determines the best solution for hosting your databases. This is true whether you're a startup with little cash or a team in an established company that operates under tight budget constraints. This section describes billing and licensing basics in Azure as they apply to Azure Database for MySQL and MySQL on Azure VMs.

Billing

Azure Database for MySQL is currently available as a service in several tiers with different prices for resources. All resources are billed hourly at a fixed rate. For the latest information on the currently supported service tiers, compute sizes, and storage amounts, see pricing page. You can dynamically adjust service tiers and compute sizes to match your application's varied throughput needs. You're billed for outgoing Internet traffic at regular data transfer rates.

With Azure Database for MySQL, Microsoft automatically configures, patches, and upgrades the database software. These automated actions reduce your administration costs. Also, Azure Database for MySQL has automated backups capabilities. These capabilities help you achieve significant cost savings, especially when you have a large number of databases. In contrast, with MySQL on Azure VMs you can choose and run any MySQL version. No matter what MySQL version you use, you pay for the provisioned VM, storage cost associated with the data, backup, monitoring data and log storage and the costs for the specific MySQL license type used (if any).

Azure Database for MySQL provides built-in high availability for any kind of node-level interruption while still maintaining the 99.99% SLA guarantee for the service. However, for database high availability within VMs, you use the high availability options like MySQL replication that are available on a MySQL database. Using a supported high availability option doesn't provide an additional SLA. But it does let you achieve greater than 99.99% database availability at additional cost and administrative overhead.

For more information on pricing, see the following articles:

Administration

For many businesses, the decision to transition to a cloud service is as much about offloading complexity of administration as it is about cost.

With IaaS, Microsoft:

  • Administers the underlying infrastructure.
  • Provides automated patching for underlying hardware and OS.

With PaaS, Microsoft:

  • Administers the underlying infrastructure.
  • Provides automated patching for underlying hardware, OS, and database engine.
  • Manages high availability of the database.
  • Automatically performs backups and replicates all data to provide disaster recovery.
  • Encrypts the data at rest and in motion by default.
  • Monitors your server and provides features for query performance insights and performance recommendations

The following list describes administrative considerations for each option:

  • With Azure Database for MySQL, you can continue to administer your database. But you no longer need to manage the database engine, the operating system, or the hardware. Examples of items you can continue to administer include:

    • Databases
    • Sign-in
    • Index tuning
    • Query tuning
    • Auditing
    • Security

    Additionally, configuring high availability to another data center requires minimal to no configuration or administration.

  • With MySQL on Azure VMs, you have full control over the operating system and the MySQL server instance configuration. With a VM, you decide when to update or upgrade the operating system and database software and what patches to apply. You also decide when to install any additional software such as an antivirus application. Some automated features are provided to greatly simplify patching, backup, and high availability. You can control the size of the VM, the number of disks, and their storage configurations. For more information, see Virtual machine and cloud service sizes for Azure.

Time to move to Azure

  • Azure Database for MySQL is the right solution for cloud-designed applications when developer productivity and fast time to market for new solutions are critical. With programmatic functionality that is like DBA, the service is suitable for cloud architects and developers because it lowers the need for managing the underlying operating system and database.

  • When you want to avoid the time and expense of acquiring new on-premises hardware, MySQL on Azure VMs is the right solution for applications that require a granular control and customization of MySQL engine not supported by the service or requiring access of the underlying OS. This solution is also suitable for migrating existing on-premises applications and databases to Azure intact, for cases where Azure Database for MySQL is a poor fit.

Because there's no need to change the presentation, application, and data layers, you save time and budget on rearchitecting your existing solution. Instead, you can focus on migrating all your solutions to Azure and addressing some performance optimizations that the Azure platform might require.

Next steps