DEV Community

François
François

Posted on • Originally published at blog.lepape.me on

How to add a MySQL Planetscale database as a grafana cloud datasource

The grafana cloud free plan is amazing for most of personal projects! I use it a lot on https://fixtheops.dev, and recently I wanted to display some data from my platnetscale mysql database to visualise the user growth. Platnetscale free plan being amazing as well, I highly advise the platform (https://planetscale.com/).

First you need to add a new datasource, in our case: mysql.

Then head over to Planetscale, and create a new password with read-only rights.

This part is important, as from grafana you can run DROP commands.

Then in the datasource add the host, user, password. As Planetscale is using SSL, make sure to toggle "With CA cert" option.

In authentication details, you need to provide the TLS/SSL root certificate. Here is how to obtain it:

# if you have pbcopy on mac:
curl https://letsencrypt.org/certs/isrgrootx1.pem | pbcopy

# otherwise, copy paste what you get from the curl command
curl https://letsencrypt.org/certs/isrgrootx1.pem
Enter fullscreen mode Exit fullscreen mode

How it should look like:

grafana-datasource

And here you are! All good to build beautiful dashboards for free ✨

Top comments (0)