If you mean that your database is Mariadb, this example flow might help:
The inject node gives msg.topic, msg.payload.timestamp and msg.payload.temperature. You could use your MQTT-in message instead.
"Construct SQL" is a function node which converts to the format required to pass to mariadb
"Espresso" is my Mariadb database. You would obviously need to replace this with your own.
To try it: copy this code and in Node-red Import and paste
[{"id":"17a9d087f8fa087b","type":"inject","z":"2a11e7cb421ab50e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"the/topic","payload":"{\"timestamp\":\"2024-05-20T15:22:59.12345\",\"temperature\":19.56}","payloadType":"json","x":170,"y":140,"wires":[["fe575281c5746cc3"]]},{"id":"fe575281c5746cc3","type":"function","z":"2a11e7cb421ab50e","name":"construct SQL","func":"// This is the data we have to work with\nconst topic = msg.topic\nconst ts = msg.payload.timestamp\nconst temp = msg.payload.temperature\n\n// Build the insert statement as msg.topic\nmsg.topic = \"INSERT INTO mytable (topic, timestamp, temperature) VALUES( :topic, :timestamp, :temperature)\"\n\n// And the values as key: value pairs in msg.payload\nmsg.payload = {\n topic: topic,\n timestamp: ts,\n temperature : temp\n}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":140,"wires":[["f7c847804ae5ca67"]]},{"id":"2ac2e186c0d2fa41","type":"debug","z":"2a11e7cb421ab50e","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":140,"wires":[]},{"id":"f7c847804ae5ca67","type":"mysql","z":"2a11e7cb421ab50e","mydb":"2381cb15.b563bc","name":"","x":520,"y":140,"wires":[["2ac2e186c0d2fa41"]]},{"id":"2381cb15.b563bc","type":"MySQLdatabase","name":"espresso","host":"127.0.0.1","port":"3306","db":"espresso","tz":"","charset":"UTF8"}]