I am using some custom MySQL functions in my Query. The query is working fine in MySQL client, but getting error through Grafana. Can anyone help me with this, please?
First of all, please tell us the error you get in Grafana.
Antony.
Probably I had the same problem here. I created a function in my database, and it works via cli.
But when I tried to call it inside a table panel query statement in grafana, I got NO DATA.
The problem here was that the user which Grafana did the queries hadnât the permissions to execute commands.
Check grafana server log (maybe /var/log/grafana/grafana.log) for something like this:
logger=tsdb.mysql t=2022-06-29T13:58:25.73682069-03:00 level=error msg=âquery errorâ err=âError 1370: execute command denied to user âgrafUserâ@â%â for routine 'mydb.my_functionââ
EDIT:
To fix:
grant execute on function my_function to âgrafUserâ;
flush privileges;
Check new permission:
show grants for âgrafUserâ;
Please adapt it to your environment.
Baracat