Why the Mysql CA Cert doesn't Work?

I need to config the MYSQL of Database to read data.
But the connection need request SSL.
Whatever I config the Database, it isn’t work for me.

Information: db query error: x509: certificate signed by unknown authority

I use the official docker container: grafana-enterprise:9.3.2-ubuntu

So, what can I do?
Or, how to use the CA cert?

Hello @wangmingjue and welcome

Not sure if it is an issue concerning Grafana. Here are a couple resources that might help you configure your server to use SSL for MySQL [1] [2]

Hope it helps!

Thank you for @antonio.merello reply.
I think my description is not accurate enough.
I have applied for a MySQL space in the company. If I want to read and write MySQL, I need to use SSL to connect.
When I use Python to write data, I use the following code:

import pymysql
import ssl

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.VerifyMode.CERT_NONE

db = pymysql.connect(host=‘host’, port=‘port’, user=‘user’, password=‘passwd’, database=‘database’,ssl=ctx)

How should I set when I use Grafana to read data?

Hi @wangmingjue,

Grafana only need valid permission so that when you add the MySQL datasource in it, it can access it from that Database user you had defined (the user should have the right PRIVILEGES so that it can allow remote access).

You can take a look at this page which defines how to do it in a very nice detailed description.

Also link to the video for the above page.

I hope this helps :slight_smile:

Thanks for @usmanahmad reply.
Grafana, which I have used for two years, is a favorite.
I have also used many DataSources, such as Prometheus, InfluxDB, MySQL, etc.
However, the MySQL to be used this time requires SSL connection. The biggest problem I have now is:
When I use MySQL, if I do not set TLS or CA Cert, the log will show that I cannot access it.
But when I use CA Cert, it will always remind me:

db query error: x509: certificate signed by unknown authority

This is really annoying!
So, do you have any suggestions or methods?
Or, how to use TLS or Cert in Grafana’s MySQL?