Hello, I’ve been trying to add a datasource of mysql db from zabbix server. Everything seems to be ok but after testing the connection it throws an error: db query error: driver: bad connection. I have no idea what’s causing the problem and it’s really hard to find a solution on web. Maybe someone could know what’s going on. Thank you in advance.
Hi @shiashia, welcome to the community.
Can you please check the grafana logs under
/var/log/grafana/grafana.log for more details about the error message
I found the error at the bottom of the file. Apparently the connection is getting refused, could it be some sort of firewall issue?
Is the grafana server ip address allowed on mysql?
This is not a grafana issue but a mysql issue
Thanks @shiashia ,
Yes it could be the following;
1- Firewall issue as MySQL by default uses port 3306 so open it in the firewall.
2- Next is that if the MySQL server is running on a remote machine (i.e. on same machine where your grafana is running) then you need to configure MySQL to allow remote connection.
3- The MySQL user which you are providing as a datasource inside Grafana to connect to MySQL server, should have correct privileges so that it can be able to access data. Please have a look at the following documentation for more information.
Hopefully it will help