ApexChart graph based on data from MySQL database

I found similar topic but it concern influxdb database.
I want to draw daily water usage, which I have in MySQL table named “water”. Into this table is two columns: Date and Amount.
MySQL is installed in HA, but it isn’t current recorder.

I try to modify data generator. Original was:

data_generator: |
      console.log(start);
      var params = new URLSearchParams({
          pretty: true,
          db: "sensors",
          q: "SELECT mean(\"value\") FROM \"solar\" WHERE \"entity_id\" = 'month' AND time >= '" + start.toISOString() + "' AND time <= '" + end.toISOString() + "' GROUP BY time(1d) fill(none)"
          });

      var myInit = { method: 'GET',
                      headers: {
                          'Accept': 'application/json',
                      },
                      mode: 'cors',
                      cache: 'default' 
      };

      const request = async () => {
          var result = [];
          const response = await fetch('http://127.0.0.1:8086/query?' + params, myInit)
          const json = await response.json();
          if (json["results"] && json["results"][0] && json["results"][0]["series"]  && json["results"][0]["series"][0] && json["results"][0]["series"][0]["values"]) {
              for(var val of json["results"][0]["series"][0]["values"]) {
                  result.push([new Date(val[0]), val[1]]);
              }
          } else {
              console.log("error: " + json)
          }
          return result;
      }
      return request();

Actually I modified all data in card but I don’t know what instert in line

const response = await fetch(‘http://influxdb.lan:8086/query?’ + params, myInit)

where should be mysql server.

You can’t do this the same way. MySQL doesn’t expose a HTTP endpoint like InfluxDB does.

You will have to use a SQL sensor and then consume the data from that.

Using SQL sensor I can get only last value? And then it saves in ha database, from where I can draw it? Correct me if this tool has bigger possibility.

Is there another way to get some part of data from mysql/MariaDB server and display it on apexchart graph?