Databases were always big part of my work and I did use MySQL in Azure before. However, I did not have time to try MySQL In-app until last week. It was nice surprise that it works quite fine (once you figure where to go) and it makes management easier as it is under same blade as web app and management can be done with Kudu.
So let us talk about how to set it up.
Open your web app blade and find ‘MySQL In App’.
Under these settings, enable service by selecting ‘ON’ and then save.
After you are notified that task is completed, you can choose ‘Manage’.
This will take you to well know place – phpMyAdmin console.
Now first issue you may face is that you have no idea what is username and password. To find your credentials, go back to web app blade, open ‘Advanced Tools’ and click ‘Go’.
In ‘Kudu’, click ‘Debug console’ (you can use console to change username and password as well), browse to ‘D:\home\data\mysql\’ and locate file ‘MYSQLCONNSTR_localdb.ini’. In this file, you have connection string for MySQL db containing credentials.
Once you get your credentials, you may still found you cannot access your phpMyAdmin console. Go to ‘Process Explorer’ in web app blade and check it out. You will find that ‘mysqld’ process is not running.
If web app does not have any requests, it goes to ‘sleep’ to save resources. Along with web app going to sleep, MySQL does same thing as no requests are coming from app side. To resolve this, go to ‘Application settings’, set ‘Always On’ to ‘ON’ and save. This will ensure that your web app constantly pinged so it does not ‘fall to sleep’. This setting will do same thing for MySQL.
No check under processes again, you should find ‘mysqld’ running.
Back to phpMyAdmin console and login in. Now you can manage MySQL, create new tables, new databases, restore backup of database you already have…everything you can normally do with phpMyAdmin. Note port number MySQL uses as MySQL In-app do not use 3306 but creates random port.