MySQL on Azure

Yes, it’s true. Microsoft is now providing hosted MySQL on Azure, via ClearDB. For now the MySQL hosting is free, but Microsoft will likely charge for it once the trial period ends. You can sign up for a MySQL database when creating an Azure Website. See my other post for information and screenshots on the sign-up process.

There are, however, a few limitations on the MySQL databases.

Limitations on MySQL in Azure

1. You can only create a MySQL database when creating an Azure website. If you want an Azure hosted MySQL database without an Azure website, you can create a website with a MySQL database, then delete the website without deleting the associated MySQL database.

2. There are no management pages for the MySQL databases.

3. At this time, you can only have a single database per subscription. Microsoft has defined a quota of 1 database per subscription.

4. You can only delete your MySQL database when deleting a website. If you want to delete a MySQL database, you can create a website, associate it to the existing MySQL database, then delete the website and database together.

5. After deleting a MySQL database, you have to wait 10-15 minutes for the delete process to complete. During those 10-15 minutes, it will appear as though you do not have a MySQL database and are not able to create one. However, once those 10-15 minutes are complete, you will then be able to create a new MySQL database. See this forum post for more details.

6. There is a maxium size of 20MB for your database.

7. There are a maxium of 4 connections to MySQL. Definitely not appropriate for a production scenario. In fact, hosting my blog there may not be the best idea…

Managing MySQL in Azure

At some point you’ll probably want to manage your MySQL database, whether to add a table, fix some data, back it up, etc. To do that, you’ll need your server name, user name, and password, as well as a MySQL management tool.

Log into Azure Management, click ‘Web Sites’ on the left, then click the name of your blog.

That will bring you to the management page for your site. Click on ‘View Connection Strings’ in the bottom-right.

You will then see your connection, strings. Keep this window open - you’ll need this data in a minute.

Database=codethugAU3sBSax;Data;User Id=132afs1as3e4a;Password=as1235098asd

Next, download MySQL Workbench. Once you have it running, click ‘New Connection in the bottom-left corner of the window.

Take the data from the connection string and enter it in the New Connection window. Enter in the ‘Data Source’ as your Hostname, and the ‘User Id’ as the Username. Then click ‘Store in Vault’, and enter the ‘Password’. Click OK to close the ‘Store in Vault’ window, then OK to finish setting up the new connection.

You will then see your new connection in the MySQL Workbench. Double-click on it.

You can then do all kinds of things to your database. One that may be helpful during the trial is finding out how much of your 20MB is being used. To do this, execute this query, substituting the name of your database:

SELECT table_schema "myDatabaseName",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ;


This is Microsoft’s first foray into providing hosted MySQL, and it’s definitely rough around the edges. I expect they will provide better management of and visibility into the hosted MySQL databases in the future. It will be interesting to see how this develops.