Error while connecting to SQL Database

Hi all,

I am trying to connect Grafana with MySQL database but am getting the following error.

Please help. Also I am not able to locate the grafana server log in my windows desktop.

Please check whether your mysql is running normally, and you need to check whether the port number of your mysql interface is correct.

There may be other possible problems, depending on your log file

And the log is under GrafanaLabs\grafana\data.

  1. What is the query?

  2. Where is your SQL database - on the same machine as Grafana, or another one
    across the network?

  3. Can you query that SQL database from the machine where Grafana is, but
    outside of Grafana (ie: to prove that you have connectivity and permissions to
    connect to the database from this machine)?

I’m sure someone else here can tell you where Grafana puts its log files under
Windows; I can’t help with that bit.


1 Like

Hi @pooh ,
I couldn’t figure out what is the query.
My SQL database is in “MySQL workbench” in the same system where I am opening grafana in localhost:3000(in chrome browser).
I have my ‘MySQL database’ from PHP myadmin in a cpanel and I installed the MySQL workbench separately in my desktop and provided access to fetch the datatables from cpanel to MySQL workbench.

I have been answered that log files are available at GrafanaLabs\grafana\data.
But in the first place I couldn’t locate the grafanalabs tab itself.

Hi @lee
the port number of mysql interface is correct. I am able to access the datatables in mysql workbench.
Also can u pls share a screenshot of where GrafanaLabs\grafana\data is. I am unable to find ‘Grafanalabs’ tab in the first place as I have never used this interface before.

Thank you,

Where is the root directory you chose when you installed the msi file? That folder is there.

You can use Computer search tool to find the folder.

In the root directory it is giving this error
t=2021-03-30T15:15:49+0530 lvl=eror msg=“query error” logger=tsdb.mysql err=“Error 1044: Access denied for user ‘claraeon’@‘’ to database ‘claraeon_WPK18’”
t=2021-03-30T15:15:49+0530 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=Claraeon method=POST path=/api/tsdb/query status=400 remote_addr=[::1] time_ms=924 size=263 referer=http://localhost:3000/datasources/edit/2/

Are you really operating a MySQL server on a public IP address?

This looks like a networking / routing problem to me (client connecting from
an address the server doesn’t allow), unless you really are doing this over
the open Internet (not a VPN)…


Was this solved? I’m having a similar problem. I’m a first time Grafana user and want to connect my MySQL database to Grafana. I get an error message 400. Workbench works fine on my computer. Local host is correct, database name is correct, user and password are correct. What am I missing?

1 Like

In some of the ways, spacing and the order of parameters in the MySql connection string does matters. So, stick to the standard format:

MysqlConn.ConnectionString = "Server=localhost;Port=1234;Database=My_Mysql_Database;Uid=root;Pwd=root;"

If the above connection string fails, try update your c# mysql connection string as shown below (without port variable as well):

MysqlConn.ConnectionString = "Server=localhost;Database=My_Mysql_Database;Uid=root;Pwd=root;"

Or, sometime the problem could be on your windows firewall, make sure your server allow access to all port associated with your mysql database.

This topic was automatically closed after 365 days. New replies are no longer allowed.