Utilizing Azure MySQL Databases

Home / Utilizing Azure MySQL Databases

One of the more interesting things from Build was the move to provide different databases as services. Since this opened the possibility of moving my LAMP-based WordPress instance to Azure, I decided to give it a try.


Microsoft provides a quick-guide to get an Azure MySQL instance set-up. This is quite straight-forward using the Azure Portal.

https://docs.microsoft.com/en-us/azure/mysql/quickstart-create-mysql-server-database-using-azure-portal

One thing I changed in my set-up was to move the compute units to the lower amount (50). This reduces to the estimated cost to $15 per month which is well within my monthly MSDN credit.

After the server was configured, I simply wanted to connect to it directly and restore a mysql dump. The only thing special to get remote connections working, as the quick guide mentions, is that one has to add the IP address of the remote machine to the list of allowed remote IP addresses. Once this was configured, I was able to immeditately connect from my Linux machine.

With an active connection, only a few commands have to be executed to restore the backup.

mysql> create database wordpress;
mysql> use wordpress;
mysql> source wordpress-backup.sql;

The WordPress backup/schema can be confirmed with “show tables;”

To get the WordPress side of things running, we only need to create a WebApp, copy (drag and drop with the Kudu Console) the WordPress contents to wwwroot, and change the MySQL connection string. In the console, you would wind up with the WordPress structure in your “wwwroot” folder.

We want to edit the wp-config.php file to enter the Azure connection string. This can be done directly in the console by clicking the edit gadget:

With these settings in place, I could query the database and everything from the MySql console. However, the WordPress site was failing with a database connection issue. I had to add a rule to the Azure Database MySQL instance to allow all IP Addresses to connect.

There may be better ways to handle that, but it got the site mostly working.

The first stumbling blocks, though, revolve around feature tier pricing. Unless I upgrade to the Azure Basic 1 (B1) tier, I couldn’t use custom domains or even SSL certs. Ugh! For a lot of people, that may not be a big deal. But, even the MySQL instance was, at minimum, ~ $15 per month. Hosting a little blog suddenly got expensive as a result of Microsoft’s Azure pricing. I can understand, but, I have no idea how much more it would cost once factoring in 25-30k views per month. My next adventure will be to look at AWS as an alternative.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.