Data Platforms in Azure, Part 3: Azure Database for MySQL

So far in this series, we’ve looked at Cosmos DB (Part 1) for globally distributed NoSQL workloads and Azure Data Lake (Part 2) for analytics and unstructured data. Now it’s time to come back to familiar relational territory with Azure Database for MySQL.


What is Azure Database for MySQL?

It’s a managed database service for MySQL in Azure. That means Microsoft takes care of the infrastructure, patching, backups, and high availability, while you focus on schema design, queries, and your application.

There are currently two flavors:

  • Flexible Server (recommended): More control over configuration, zone redundancy, stop/start for cost savings.
  • Single Server (older, now in retirement): Still around, but Flexible Server is the future.

Reference: Azure Database for MySQL – Flexible Server


Why pick MySQL on Azure?

  • You’re already running MySQL apps and want a managed service.
  • You want open-source database compatibility but don’t want to manage VMs.
  • Built-in backup/restore and HA without setting up replication yourself.
  • Scale up/down compute and storage with minimal effort.

Getting Started

Step 1: Create a MySQL flexible server

Portal workflow:

  1. Create a resourceDatabasesAzure Database for MySQL – Flexible Server.
  2. Fill in the basics:
    • Server name: mysql-flex-demo
    • Region: choose close to app servers.
    • Authentication: username + password.
    • Compute + storage: start with B_Standard_B1ms (1 vCore, 2 GB RAM) for dev/test.

CLI example:

az mysql flexible-server create \
  --resource-group rg-mysql-demo \
  --name mysql-flex-demo \
  --admin-user dbadmin \
  --admin-password 'S3curePass!' \
  --sku-name Standard_B1ms \
  --storage-size 20 \
  --location westus3 \
  --public-access 203.0.113.10

This creates a server you can connect to from your IP.


Step 2: Create a database

az mysql flexible-server db create \
  --resource-group rg-mysql-demo \
  --server-name mysql-flex-demo \
  --database-name appdb

Step 3: Connect and test

From your machine:

mysql -h mysql-flex-demo.mysql.database.azure.com \
  -u dbadmin@mysql-flex-demo \
  -p appdb

Schema and Data Example

Let’s say you’re building a simple esports roster app.

CREATE TABLE players (
  player_id INT AUTO_INCREMENT PRIMARY KEY,
  gamer_tag VARCHAR(50) NOT NULL,
  join_date DATE NOT NULL,
  skill_level INT DEFAULT 1
);

INSERT INTO players (gamer_tag, join_date, skill_level)
VALUES 
  ('AceShot', '2025-09-01', 3),
  ('PixelNinja', '2025-09-01', 2);

Querying:

SELECT gamer_tag, skill_level
FROM players
WHERE skill_level >= 2
ORDER BY join_date DESC;

Key Features to Know

  • Backups & PITR (Point in Time Restore): By default, backups are taken daily and retained for 7–35 days. You can restore to a new server at any point in that window.
  • Scaling: You can scale compute (vCores) and storage independently with a few clicks or CLI commands.
  • High Availability: Deploy with zone redundancy to get automatic failover across availability zones.
  • Maintenance windows: Flexible Server lets you pick your own maintenance window so you’re not surprised by restarts.

Security Basics

  • Firewall rules: Restrict by IP or use private endpoints.
  • SSL: Connections enforce SSL by default; you can download CA certs from the portal.
  • Identity: Use Azure AD authentication for tighter integration instead of just usernames/passwords.

👉 Reference: Secure access to MySQL Flexible Server


When to Use Azure Database for MySQL

Good fit:

  • Web and mobile apps built on LAMP/LEMP stacks.
  • SaaS products that already use MySQL.
  • Moderate-scale relational workloads where managed service is a priority.

Not ideal for:

  • Very large, analytics-heavy queries (look at Synapse or Data Lake instead).
  • Workloads requiring SQL Server features (use Azure SQL Database or MI).

Wrap-Up

Azure Database for MySQL gives you a familiar open-source database with all the benefits of PaaS: managed backups, HA, scaling, and built-in security. You can get started quickly with the CLI, load your schema, and be running production workloads without worrying about patching or replication.

In Part 4 of this series, we’ll cover Azure Database for PostgreSQL—another open-source favorite with some advanced features unique to Azure.


References


Discover more from SQLYARD

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from SQLYARD

Subscribe now to keep reading and get access to the full archive.

Continue reading