How to add mysql datasource to grafana

Hi i am using grafana first time please suggest me how to add a mysql data source into grafana

Go to Datasources, give the url link of where your sql db is stored

ex:- yourserver:port number

ex:-localhost:8000(change it to whichever port youre running sql on)

hi,

i have a little bit of idea about it hope it can help you

Go to Datasources ->select type as mysql->the give url on which your mysql is working (it generally works on 3306 port)->then enter database name -> and enter username and password of your mysql then the connection will be created.

Please refer to the documentation

Hi, I have the same doubt about it. I have followed all the steps described in documentation and the step described by geetu and I am getting an error in my grafana:

Templating init failed

Error 1146: Table ‘my2.status’ doesn’t exist

I google it but couldn’t find any awnser about this error. Can anyone help?
Thanks

That error tells you that you have a template variable defined in a dashboard that tries to read from my2.status table which you doesn’t seem to have in your database.

Hello @danilofm
It looks like you’ve installed the dashboard but not the necessary database for use with that dashboard. I ran into the same. See the authors git repo here. It will import a my2 table with some stored functions.

1 Like

I had my2 installed and using mysql and it was working.
Now the native plugin for mysql is missing and giving the same error as above.
Not sure where mysql plugin went. Cannot even add a new dashboard with mysql as its no longer an option. Trying to find the plugin to re-install now.

Here is the log

t=2021-04-15T14:58:37+0000 lvl=eror msg=“query error” logger=tsdb.mysql err=“Error 1049: Unknown database ‘exampledb’”
t=2021-04-15T16:03:05+0000 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=POST path=/api/dashboards/db status=412 remote_addr=192.168.220.54 time_ms=20 size=88 referer=“http://192.168.220.145:3000/d/*******/2mysql-simple-dashboard?orgId=1&from=1618400760373&to=1618433110141”
t=2021-04-15T17:56:20+0000 lvl=eror msg=“Could not find plugin definition for data source: mysql”
t=2021-04-15T17:56:20+0000 lvl=eror msg=“Could not find plugin definition for data source: mysql”
t=2021-04-15T17:56:33+0000 lvl=eror msg=“Could not find plugin definition for data source: mysql”
t=2021-04-15T17:56:33+0000 lvl=eror msg=“Could not find plugin definition for data source: mysql”
t=2021-04-15T17:56:33+0000 lvl=eror msg=“Could not find plugin definition for data source: mysql”

Did a dpkg install over the existing and mysql is now an option again.
Did not lose any of my existing dashboards :slightly_smiling_face: