Multiple datasources in MySQL

Hello,
I am looking for advice to help solve a problem.

I would like to monitor data in different MySQL databases on the same server.
They have all the same table structure and I would like to be able to present data from one or more databases in one Grafana panel.
As far as I see, the Typescript frontend posts a query to the Go backend using a “datasourceId” and other information.
Would you think it is possible to do minor changes in the backend to handle multiple datasourceIds (and return the corresponding data) or does this lead down a never-ending rabbit hole?

Thanks so much for your help!
Peter

MySQL doesnt isolate databases and its more similar to schemas in other dbms.

Even though you configured your datasource for a certain database you can still query all other databases over the same connection. Just prefix the table with the database.

SELECT * FROM database.table;

I wrote sql gateway with Grafana integration. You can try it :slight_smile:

1 Like

Thanks a lot for your message!
I’ll try it!