I have setup and configured a MySQL8 server & database in Azure and it seems to be working OK.
I can connect to it from my laptop using HeidiSQL. I can log in to the server, see the database and update the fields and contents, therefore I know the connection is open, I have the right server name and the credentials work.
The problem comes when trying to connect any Grafana instance to the database. I have self hosted instance on the same network as my laptop, an Azure hosted instance and the free cloud instance. All 3 of theses are running Grafana version 6.4.3. None of these can connect to the database as a data source and seem to give the same symptoms.
When I enter the details and click connect & save, the system displays “Query failed. Please inspect Grafana server log for details”. I have checked the server log and it has 2 entries:
t=2019-10-20T19:30:34+0000 lvl=eror msg=“query error” logger=tsdb.mysql err=“Error 9002: Server is not ready for incoming connections.”
t=2019-10-20T19:30:34+0000 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=POST path=/api/tsdb/query status=400 remote_addr=x.x.x.x time_ms=56 size=227 referer=http://database.uksouth.cloudapp.azure.com:3000/datasources/edit/6/
After reading an old thread about a similar problem blaming MySQL8 (although I believe it was later fixed) I set up a MySQL5.7 server and database. This gave the same error on the Grafana connection screen, but gave this error in the log file:
t=2019-10-20T21:39:42+0000 lvl=eror msg=“query error” logger=tsdb.mysql err=“Error 9999: An internal error has occurred. Please retry or report your issues.”
I have tried various things like turning off the SSL requirement on the database and ticking “Skip TLS verify” on the connection settings. I have also added the IP address of all the instances to the security settings of the database server and enabled the option for allowing it to see the rest of the Azure estate.
I have connected to other MySQL databases which are not hosted in Azure and it worked perfectly. I have read old threads about a potential bug in Grafana where it won’t connect to Azure MySQL databases, but this was previous versions and it was closed so it it looks like these were resolved.
I assume it is something which I have not configured correctly for Grafana and the Azure hosted database to connect, but I can’t find it and would really appreciate some help. Grafana looks awesome and I can’t wait to set up a dashboard visualising all my data.
Sorry for the huge post, but I wanted to give as much detail as possible.
Thanks for your time.