diff --git a/src/dialects/mysql2/index.js b/src/dialects/mysql2/index.js index 3c1c225fa0..79e832192c 100644 --- a/src/dialects/mysql2/index.js +++ b/src/dialects/mysql2/index.js @@ -29,8 +29,8 @@ assign(Client_MySQL2.prototype, { return require('mysql2') }, - validateConnection() { - return true + validateConnection(connection) { + return !connection._fatalError }, // Get a raw connection, called by the `pool` whenever a new @@ -50,6 +50,10 @@ assign(Client_MySQL2.prototype, { }) }, + destroyRawConnection(connection) { + if (!connection._fatalError) return Client_MySQL.prototype.destroyRawConnection(connection) + }, + processResponse(obj, runner) { const { response } = obj const { method } = obj