MySQL is a popular open source, SQL database. Using the Azure Management Portal, you can create a virtual machine running Windows Server 2012 R2 from the Image Gallery. You can then install and configure it as a MySQL Server.
This tutorial shows you how to:
Use the Management Portal to create a virtual machine running Windows Server 2012 R2.
Install and run the community version of MySQL 5.6.23 as a MySQL Server on the virtual machine.
On the command bar at the bottom of the window, click New.
Under Compute, click Virtual Machine, and then click From Gallery.
The first screen lets you Choose an Image for your virtual machine from one of the lists in the Image Gallery. (The available images may differ depending on the subscription you're using.) Click the arrow to continue.
The second screen lets you pick a computer name, size, and administrative user name and password. If you just want to try out Azure Virtual Machines, fill in the fields as shown in the image below. Otherwise, chose the tier and size required to run your app or workload. Here are some details to help you fill this out:
The third screen lets you configure resources for networking, storage, and availability. Here are some details to help you fill this out:
If you want a virtual machine to use a virtual network, you must specify the virtual network when you create the virtual machine. You can't join the virtual machine to a virtual network after you create the VM. For more information, see Azure Virtual Network Overview.
- For details about configuring endpoints, see [How to Set Up Endpoints to a Virtual Machine](../articles/virtual-machines-set-up-endpoints-classic-portal.md). ![Configure the connected resources of the virtual machine](https://acomdpsstorage.blob.core.windows.net/dpsmedia-prod/azure.microsoft.com/en-us/documentation/articles/virtual-machines-mysql-windows-server-2008r2/20150514052253/includes/virtual-machines-create-windowsvm/resourceconfiguration.png)
The fourth configuration screen lets you configure the VM Agent and some of the available extensions. Click the check mark to create the virtual machine.
The VM agent provides the environment for you to install extensions that can help you interact with or manage the virtual machine. For details, see Using Extensions.
After the virtual machine is created, the Management Portal lists the new virtual machine under Virtual Machines. The corresponding cloud service and storage account also are created and are listed in those sections. Both the virtual machine and cloud service are started automatically and their status is listed as Running.
After the virtual machine is created, you can optionally attach an additional data disk. This is recommended for production workloads and to avoid running out of space on the OS drive (C:), which is currently limited to 127 GB and includes the operating system.
See How to Attach a Data Disk to a Windows Virtual Machine and follow the instructions for attaching an empty disk. Set the host cache setting to None or Read-only.
Next, you'll log on to the virtual machine so you can install MySQL.
If you need to reset the user name or password, or reset RDP in the virtual machine, see How to Reset a Password or the Remote Desktop Service for Windows Virtual Machines. For detailed troubleshooting steps, see Troubleshoot Remote Desktop connections to a Windows-based Azure Virtual Machine.
If you haven't already done so, sign in to the Azure Management Portal.
Click Virtual Machines, and then select the appropriate virtual machine.
On the command bar, click Connect.
Click Open to use the Remote Desktop Protocol file that's automatically created for the virtual machine.
Click Connect to continue.
Type the credentials for the administrative account on the virtual machine, and then click OK.
In most cases, you'll use the user name and password that was specified when the virtual machine was created. Check the user name to make sure it has the correct domain information:
Click Yes to verify the identity of the virtual machine.
You can now work with the virtual machine remotely.
If you cannot log on to the virtual machine, see How to Reset a Password or the Remote Desktop Service for Windows Virtual Machines.
Follow these steps to install, configure, and run the Community version of MySQL Server:
These steps are for the 220.127.116.11 Community version of MySQL and Windows Server 2012 R2. Your experience might be different for different versions of MySQL or Windows Server.
On the Type and Networking page, specify your desired configuration type and connectivity options, including the TCP port if needed. Click Show Advanced Options, and then click Next.
On the Accounts and Roles page, specify a strong MySQL root password. Add additional MySQL user accounts as needed, and then click Next.
On the Windows Service page, specify changes to the default settings for running the MySQL Server as a Windows service as needed, and then click Next.
On the Advanced Options page, specify changes to logging options as needed, and then click Next.
On the Apply Server Configuration page, click Execute. When the configuration steps are complete, click Finish.
On the Product Configuration page, click Next.
On the Installation Complete page, click Copy Log to Clipboard if you want to examine it later, and then click Finish.
From the start screen, type mysql, and then click MySQL 5.6 Command Line Client.
Enter the root password that you specified in step 11 and you'll be presented with a prompt where you can issue commands to configure MySQL. For the details of commands and syntax, see MySQL Reference Manuals.
You can also configure server configuration default settings, such as the base and data directories and drives, with entries in the C:\Program Files (x86)\MySQL\MySQL Server 5.6\my-default.ini file. For more information, see 5.1.2 Server Configuration Defaults.
If you want the MySQL Server service to be available to MySQL client computers on the Internet, you must configure an endpoint for the TCP port on which the MySQL Server service is listening and create an additional Windows Firewall rule. This is TCP port 3306 unless you specified a different port on the Type and Networking page (step 10 of the previous procedure).
You should carefully consider the security implications of doing this, because this will make the MySQL Server service available to all computers on the Internet. You can define the set of source IP addresses that are allowed to use the endpoint with an Access Control List (ACL). For more information, see How to Set Up Endpoints to a Virtual Machine.
To configure an endpoint for the MySQL Server service:
To add a Windows Firewall rule that allows MySQL traffic from the Internet, run this command at an administrator-level Windows PowerShell command prompt on the MySQL server computer.
New-NetFirewallRule -DisplayName "MySQL56" -Direction Inbound –Protocol TCP –LocalPort 3306 -Action Allow -Profile Public
To test your remote connection to the MySQL Server service running on the Azure virtual machine, you must first determine the DNS name corresponding to the cloud service that contains the virtual machine running MySQL Server.
From the virtual machine dashboard, note the DNS Name value under the Quick Glance section. Here is an example:
From a local computer running MySQL or the MySQL client, run this command to log in as a MySQL user:
mysql -u <yourMysqlUsername> -p -h <yourDNSname>
For example, for the MySQL user name dbadmin3 and the testmysql.cloudapp.net DNS name for the virtual machine, this is the command:
mysql -u dbadmin3 -p -h testmysql.cloudapp.net
For information on MySQL, see the MySQL Documentation.