Currently using: https://github.com/felixge/node-mysql
I have the following code:
var connection = mysql.createConnection({
host : \'localhos
connection.end() does it job regardless to fatal error. If a fatal error occurs before the COM_QUIT
packet can be sent, an err
argument will be provided to the callback, but the connection will be terminated regardless of that.
Also check destroy() method. This will cause an immediate termination of the underlying socket.
You can add error handler.
https://github.com/felixge/node-mysql/blob/master/Readme.md#error-handling
// I am Chuck Norris:
connection.on('error', function() {});
Once terminated, an existing connection object cannot be re-connected by design.
Check here. It's showing connecting back after disconnect.
https://github.com/felixge/node-mysql/blob/master/Readme.md#server-disconnects