Azure Database For MySQL E-Book
Azure Database For MySQL E-Book
Iv
Azure Database
Azure Database for MySQL makes it easy to build
new applications or migrate existing ones to the
cloud using the programming languages and
build new
You can pay as you go under a simple yet flexible
pricing model, so you won’t need to pay extra for
automatic patching and backups, monitoring, or
Audience
This paper is targeted at developers who are
thinking of building new cloud apps on MySQL or
moving existing MySQL apps to the cloud. It
provides an overview of Azure Database for
MySQL and the value that it provides as a fully
managed, open-source database service. It also
covers the key concepts you’ll need to understand
to best put Azure Database for MySQL to use,
together with a list of quickstarts, tutorials, and
other resources to help you get started using it.
Introduction: MySQL databases in the Updates and upgrades 9
cloud 2 Drivers and tools compatibility 9
Azure Database for MySQL 3 5-minute quickstarts 9
Step 1: Create a server 9
Key concepts 5
Step 2: Connect and query 10
Databases and servers 5
Step-by-step tutorials 2
Server pricing tiers and resources 5
How-to guides 2
High availability 6
Videos 2
Business continuity 6
Replication 3
Data access and security 7
Developing with Azure Kubernetes
Firewall rules 7
Service 3
Virtual network rules 7
Configuring SSL 7 Advanced Threat Protection 3
Advanced Threat Protection 8
Additional resources 3
Monitoring and tuning 8 Limitations 3
Samples 4
Replication 8
References 4
Getting started with Azure Database Azure Database Migration Guide 4
for MySQL 9 Other useful links 4
This document is provided “as is.” Information and views expressed in this document, including URL and other internet website
references, may change without notice. You bear the risk of using it.
This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use
this document for your internal, reference purposes
2
To fully appreciate the value of open-source To make MySQL work in the enterprise,
software, it’s worth examining a few of the however, you’ll need a lot more than just a
benefits it provides. These include open hosted MySQL database service. Rarely does
standards that are accessible to everyone, any database exist in isolation, which is why
along with full visibility into the code base. you’ll also want to make sure your chosen
Everyone benefits from community efforts to platform offers everything else you’ll need to
improve and support the software, a lack of effectively put your chosen database service
licensing fees, and lower development costs. to use. The specific services you’ll need will
Openly available source code speeds the depend on your app, such as whether you’ll
delivery of new offerings, and freedom from be ingesting massive data volumes,
vendor lock-in facilitates increased choice implementing real-time streaming analytics,
across platforms. Best practices for building an AI-powered chatbot, or simply
maximizing performance and availability are deploying an instance of Drupal or WordPress.
shared freely, as are those for deployment and And don’t forget about development tools,
operations, and reliability is maximized software frameworks, and integration; you
through community vetting. In addition, the won’t want to complicate things unnecessarily
flexibility that open-source software provides in those areas either. After all, even if a cloud
for developers can help attract more and platform provides all the services you need, it
better talent. won’t do you much good if you need to learn
an entirely new skill set before you can
It’s for these reasons that open-source
effectively put those services to use.
databases such as MySQL have grown to be
so popular. MySQL Community Edition is In the rest of this paper, we’ll provide an
supported by a large and vibrant community overview of Microsoft Azure Database for
of open-source developers. As the database MySQL, a fully managed MySQL database
component of the popular LAMP (Linux, service, and the value that it brings to you as a
Apache, MySQL, PHP) web application stack, developer. We’ll also cover the key concepts
MySQL remains one of the most popular you’ll need to understand to best put Azure
database management systems among Database for MySQL to use, together with a
developers today. list of quickstarts, tutorials, and other
resources to help you get started using it.
3
As an Azure data service, Azure Database for MySQL is backed by Azure compute and Azure Storage,
and is built to work with the extensive range of other Azure services—including Azure Power BI
Embedded, Azure App Service, and the Azure AI platform. And like all Azure services, Azure Database
for MySQL is built on a world-class infrastructure with unmatched global reach; Azure has more
global regions than any other cloud provider, enabling you to bring your apps closer to your users
around the world, preserve data residency, and satisfy compliance demands. Finally, when you
choose Azure Database for MySQL, you’ll get comprehensive compliance and Azure IP Advantage, a
program for Azure customers that provides protection against intellectual property (IP) risks
5
also replicated to a paired datacenter in computers can access a server, based on the
another region within the same geography, originating IP address for each request. These
allowing you to restore your server in any firewall rules apply to all databases on the
Azure region in the event of a disaster. There’s logical server and are configured as ranges of
a delay between when backups are taken and IP addresses. You can also configure the
when they’re replicated to another region, so, firewall to allow access from all Azure services
if a disaster occurs, you may face some data and all Azure subnets. Firewall rules can be
loss. configured by using the Azure portal or the
Azure CLI.
When you provision a server, you need to
decide whether to augment locally redundant The online documentation for Azure Database
backups with geo-redundant backups because for MySQL provides more information about
you can’t change this option afterward. firewall rules, including connecting from the
Whichever option you choose, Azure Database internet, connecting from Azure,
for MySQL provides up to 100 percent of your programmatically managing firewall rules, and
provisioned server storage as backup storage troubleshooting the database server firewalls.
at no additional cost.
Virtual network rules
Performing a restore creates a new server Virtual network rules, a firewall security
from the original server's backups. Recovery feature, control whether your Azure Database
time depends on several factors, including the for MySQL server accepts communications
size of the database or databases, transaction sent from particular subnets on virtual
log size, network bandwidth, and the total networks. To create a virtual network rule, you
number of databases being recovered in the must first have a virtual network and a virtual
same region at the same time. The estimated network service endpoint to reference. If you
recovery time is usually less than 12 hours. configure your database firewall to allow
Point-in-time restore is available with either access from all Azure services and all Azure
backup redundancy option, and it creates a subnets, you can use virtual network rules to
new server in the same region as your original achieve much more granular control.
server. Geo-restore, which is available only if The online documentation for Azure Database
you configured your server for geo-redundant for MySQL provides more information about
storage, allows you to restore your server to a virtual network rules, including their benefits,
different region. characteristics, limitations, and use with
The online documentation for Azure Database ExpressRoute.
for MySQL provides additional detail on how
Configuring SSL
backup and restore work.
Enforcing Secure Sockets Layer (SSL)
Data access and security connections between your client applications
and an Azure Database for MySQL server
With Azure Database for MySQL, you have
encrypts all traffic between the two, which can
several capabilities to help ensure safe and
help protect against “man-in-the-middle”
secure access.
attacks. Enforcement of SSL connections is
Firewall rules enabled by default when a new Azure
By default, all access to an Azure Database for Database for MySQL server is provisioned. It’s
MySQL server is blocked by its firewall. You worth noting, however, that some application
can use firewall rules to specify which frameworks don’t enable SSL by default
during installation, so you’ll want to check this
8
PHP Connect to an Azure Database for MySQL database using a PHP application,
and then use SQL statements to query, insert, update, and delete data.
Java Connect to an Azure Database for MySQL database by using a Java
application with a JDBC driver, and then use SQL statements to query, insert,
update, and delete data.
.NET Connect to an Azure Database for MySQL database by using a C#
application, and then use SQL statements to query, insert, update, and
delete data.
Python Connect to an Azure Database for MySQL database by using Python, and
then use SQL statements to query, insert, update, and delete data.
Node.js Connect to an Azure Database for MySQL database by using Node.js, and
then use SQL statements to query, insert, update, and delete data.
Ruby Connect to an Azure Database for MySQL database by using
a Ruby application and the mysql2 gem, and then use SQL statements to
query, insert, update, and delete data.
C++ Connect to an Azure Database for MySQL database by using a C++
application, and then use SQL statements to query, insert, update, and
delete data.
Go Connect to an Azure Database for MySQL database by using Go, and then
use SQL statements to query, insert, update, and delete data.
MySQL Connect to an Azure Database for MySQL database by using the MySQL
Workbench Workbench application.
2
how you can deploy and scale your Read replicas, which you can use to
web app in the cloud and replicate data from an Azure Database
demonstrates how Azure Database for for MySQL server (master) to up to five
MySQL works with Azure App Service. read-only servers (replicas) within the
The demo shows how to deploy same Azure region. The how-to guides
WordPress (which typically uses provide step-by-step instructions on
MySQL as a database) and how to how to create and manage read
make WordPress work with Azure replicas in Azure Database for MySQL
Database for MySQL. by using the Azure portal or by using
the Azure CLI.
Connect applications running in
Kubernetes to Azure Database for
Developing with Azure
MySQL shows how to connect
container applications running in Kubernetes Service
Kubernetes to Azure Database for Azure Kubernetes Service provides a managed
MySQL by using the Open Service Kubernetes cluster you can use in Azure.
Broker for Azure, an implementation Connecting Azure Kubernetes Service and
of the Open Service Broker API for Azure Database for MySQL covers some
Azure services. The video covers the options to consider when using Azure
rationale for using a Service Broker Kubernetes Service with Azure Database for
and how it can help you benefit from MySQL, including accelerated networking and
the built-in high availability and Open Service Broker for Azure.
security offered by Azure Database for
MySQL. Advanced Threat Protection
Advanced Threat Protection for Azure
Replication Database for MySQL can help detect
Azure Database for MySQL supports two types anomalous activities that may indicate unusual
of replication: or potentially harmful attempts to access or
Data-in replication, which you can use exploit your databases. Our how-to article on
to synchronize data from a MySQL Advanced Threat Protection for Azure
server that’s running on-premises, in Database for MySQL walks you through
virtual machines, or in a database setting up threat detection by using the Azure
service hosted by another cloud portal, exploring anomalous database
provider into the Azure Database for activities, and exploring threat-detection
MySQL service. How to configure alerts.
Azure Database for MySQL data-in
replication walks you through creating
Additional resources
an Azure Database for MySQL server The following are some additional resources
to be used as a replica, configuring the to help you get started with Azure Database
master server, dumping and restoring for MySQL.
the master server, linking the master Limitations
and replica servers to start data-in
Limitations in Azure Database for MySQL
replication, and relevant stored
describes various types of limits in the
procedures.
database service—including maximum
connections per pricing tier/number of
4
vCores, storage engine support, data Azure Database for MySQL data-in replication
manipulation statement support, functional stored procedures covers the stored
limitations, and current known issues. procedures needed to set up or remove data-
in replication between a master and replica.
Samples
Azure CLI samples for Azure Database for Azure Database Migration Guide
MySQL provides links to sample Azure CLI The Azure Database Migration Guide provides
scripts for Azure Database for MySQL— step-by-step guidance on migrating to various
including scripts to create a server and firewall Azure data services, in addition to a selection
rule, scale a server, change server of case studies and partner tools. You can just
configurations, restore a server, and enable select your source and target to get started,
and download server logs. or, if applicable, you can go directly to the
scenario on migrating from MySQL to Azure
References
Database for MySQL.
Azure CLI reference for Azure Database for
MySQL provides a list of Azure CLI commands Other useful links
for managing Azure Database for MySQL Pricing information for Azure
servers, with links to more information on Database for MySQL
each command.
Online documentation on Azure
Azure Database for MySQL REST API reference Database for MySQL
covers the REST operations you can use with
Azure pricing calculator for Azure
Azure Database for MySQL. You can use these
Database for MySQL
REST operations to create, delete, manage,
and list servers, server configurations, Azure service health dashboard
databases, server logs, and firewall rules, and Azure product availability by region
to list all available REST operations.
Azure Database for MySQL blog
5
Conclusion
Microsoft Azure provides an end-to-end you’ll have everything you need to build great
platform for open-source applications, apps and deploy them across the globe.
including a fully managed MySQL database
service for app developers. Azure Database for
MySQL can be provisioned in minutes and Sign up for a free Azure
scaled in seconds, with built-in high account and get started with
availability and a simple, flexible pricing model Azure Database for MySQL
that includes automatic patching and backups, today.
monitoring tools, essential security features,
and more. And because it’s a part of Azure,
when you choose Azure Database for MySQL,