Exercise: Explore Azure Database for MySQL Flexible server

Completed

In this exercise, you will create an Azure Database for MySQL server and configure it.

Important

You need your own Azure subscription to complete this exercise. If you do not have an Azure subscription, create an Azure free trial.

Create a Resource Group

Note

You can use an existing resource group but following these steps makes it easy to delete things after you have finished the exercise.

  1. In a web browser, navigate to the Azure portal. Sign in using an Owner or Contributor account.
  2. Under Azure services, select Resource Groups, then select + Create.
  3. Check that the correct subscription is displayed, then enter the Resource group name as MyFlex_nnn. Replace nnn with a random number. Select a Region.
  4. Select Review + create. Then select Create.

Create an Azure Database for MySQL

  1. Under Azure services, select + Create a resource. Under Categories, select Databases. Under Azure Database for MySQL, select Create.

  2. Under Choose a deployment option to create a MySQL server, select the Resource type dropdown box to view the options. Select Flexible server (Recommended). Select Create.

    Screenshot showing the Azure Database for MySQL Flexible server (recommended) page.

  3. On the Flexible server Basics tab, enter each field as follows:

    1. Subscription - your subscription.
    2. Resource group - MyFlex_nnn.
    3. Server name - mysql-fxnnn (replace nnn with random numbers).
    4. Region - select the same region as the resource group.
    5. MySQL version - select 8.0.
    6. Workload type - for development or hobby projects.
    7. Compute + storage - Burstable. Select Configure server and examine the configuration options. Do not make any changes and close the blade.
    8. Availability zone - No preference.
    9. High availability - leave unchecked.
    10. In admin username, enter demo.
    11. In password, enter Pa$$w0rd.
    12. Select Next: Networking >
  4. On the Flexible server Networking tab, enter each field as follows:

    1. Connectivity method: (o) Public access (allowed IP addresses)
    2. Under Firewall rules, select + Add current client IP address. This adds your current IP address as a firewall rule. You can optionally name this firewall rule to something meaningful.
  5. Select Review + create. Review your settings including how long it will take to create the server, then select Create to create your Azure Database for MySQL server. When the deployment is complete, select Go to resource ready for the next step.

    Screenshot showing the Azure Database for MySQL flexible server deployment is in progress page.

Inspect the server and increase the backup retention period

  1. Navigate to the Overview blade, under Settings, select Compute + storage. This blade displays your current Compute tier, and the option to upgrade it. It also displays the amount of storage you have provisioned, and the option to increase storage.
  2. Under backups, the backup retention period in days is displayed. Use the slider bar to change the backup retention period to 1 day. Select Save to retain your changes.
  3. Under Settings, select Databases. The four system databases used by MySQL are displayed. When you create database, it will be listed here.

Examine server parameters

  1. Under Settings, select Server parameters.
  2. Use the search bar to search for and examine the following parameters. Examine the options by selecting each drop list, but do not change these parameters.
    • character_set_server
    • collation_server
    • default_storage_engine
    • blackhole

Note

You cannot change the blackhole parameter. Read the message at the top of the page about modifiable and non-modifiable server parameters.

When you have completed this exercise, return to the Overview page and then select STOP to stop the server. This will prevent charges being incurred while you are not using it. The server will be used in the next module.

Optional exercise - Create an Azure Database for MySQL with high availability

  1. Under Azure services, select + Create a resource. Under Categories, select Databases. Under Azure Database for MySQL, select Create.
  2. Under Choose a deployment option to create a MySQL server, select the Resource type dropdown box to view the options. Select Flexible server (Recommended). Select Create.
  3. On the Flexible server Basics tab, enter each field as follows:
    1. Subscription - your subscription.
    2. Resource group - MyFlex_nnn.
    3. Server name - mysql-fxnnn (replace nnn with random numbers).
    4. Region - select the same region as the resource group.
    5. MySQL version - select 8.0.
    6. Workload type - For small or medium size databases.
    7. Compute + storage - General Purpose. Select Configure server and examine the configuration options. Do not make any changes and close the blade.
    8. Availability zone - 1. (If you leave this as No preference, Azure will automatically choose an availability zone for your primary and secondary servers. You must specify the availability zone if you have a preference.)
    9. High availability - checked. Note the estimated costs when this option is selected.
    10. High availability mode - select Zone redundant.
    11. In admin username enter demo.
    12. In password enter Pa$$w0rd.
    13. Select Next: Networking >
  4. On the Flexible server Networking tab, enter each field as follows:
    1. Connectivity method: (o) Public access (allowed IP addresses)
    2. Under Firewall rules, select + Add current client IP address. This adds your current IP address as a firewall rule. You can optionally name this firewall rule to something meaningful.
  5. Select Review + create. Review your settings including how long it will take to create the server, then select Create to create your Azure Database for MySQL server. When the deployment is complete, select Go to resource ready for the next step.

Inspect the server

  1. Navigate to your new Azure Database for MySQL server and select the Overview page. Notice that the availability zone is 1, which is what you specified for the primary server.

  2. From the left menu, under Settings, select High availability. Notice that that primary availability zone is 1 (as on the Overview page), and the standby availability zone is 3.

    Screenshot showing the Azure Database for MySQL high availability primary zone and standby zone page.

Force a failover

  1. If necessary, from the left menu, under Settings, select High availability.

  2. Select Forced failover. Notice the estimated time for the failover operation to complete.

  3. Select OK. The failover process is initiated. When the failover is complete, a notification is displayed.

    Screenshot showing the Azure Database for MySQL forced failover page.

    Screenshot showing the Azure Database for MySQL forced failover notification page.

  4. Navigate to the High availability blade again. You may need to refresh your browser window to see the latest information. The primary zone is now 3 and the standby availability zone is 1.

  5. On the Overview blade, from the top menu, select Delete to delete the server. A notification is displayed.

  6. Select the I have read and understand that this server, as well as any databases it contains, will be deleted checkbox, and then select Delete.

Important

Be sure to delete the server when you have completed this exercise. If you do not delete the server, you will incur charges. This server will not be used in future exercise.