Possibly the best way would be to first look at the code of the current node, then when you think you understand it, fork that repository and amend that node to do what you want. Once it is working you can send the changes back to the author as a PR to get it included in the standard node.
In fact first raise an issue on the node and offer to help the author implement the feature.
This would have to be an optional behaviour if you wanted to update the existing node. Having to check then closing and reopening the connection all the time could potentially make the performance really bad if not implemented properly.
There is now a node called: node-red-contrib-mysql2 that can absolutely do what you need. You set the configuration (including credentials) in a JSON object, and it will connect to multiple different MYSQL DB's. Obviously it introduces the risk of people getting your DB credentials from the Node-RED flow, but I was willing to make that trade-off.