A Node-RED node to connect to a MySQL or a MariaDB database, using TLS (SSL) and compatible with "Caching SHA2 password" authentication method (MySQL >= 8).
npm install node-red-contrib-mysql2-tsNode-RED node to read and write to a MySQL or a MariaDB database.
It uses TLS (SSL) encryption and is compatible with "Caching SHA2 password" authentication method (MySQL >= 8).
Remember: if you like it, please star it! 🥰
Official repository: https://github.com/modbus2mqtt/node-red-contrib-mysql2-ts
node-red-contrib-mysql2-ts was created as a fork of node-red-contrib-stackhero-mysql which was developed by Stackhero.
If you are looking for powerful managed services, like Node-RED, MySQL or MariaDB, you should seriously consider Stackhero 🤓
- Managed MySQL databases
- Managed MariaDB databases
- Managed Node-RED service
This node is really simple.
Put your query in the topic variable and, if you have arguments, put them in an object in the payload variable.
You will get the result in the payload output variable.
Example:
``javascriptusers
msg.topic = 'SELECT * FROM WHERE name = :name AND age > :age;';`
msg.payload = { name: 'Adrien', age: 30 };
return msg;payload
If you have multiple arguments, put them in an array of objects in the variable.payload
You will get the result in the output variable.
Example:
`javascriptusers
msg.topic = 'INSERT INTO (name, age) VALUES( :name, :age) ;';`
msg.payload = [
{ name: 'Adrien', age: 30 },
{ name: 'Maria', age: 62 }
]
return msg;topic
> Avoid SQL injections!!
>
> Do not NEVER EVER put variables content in directly!payload
> Always use the variable to pass your arguments.
You have to connect using TLS encryption. Simply check the box in this node configuration.
You are probably using another node than node-red-contrib-mysql2-ts and tryin to connect to a MySQL >= 8 server using "Caching SHA2 password" authentication method.
To resolve that issue, simply use this node node-red-contrib-mysql2-ts`.