insecureAuth support (was: bad handshake)
See original GitHub issueOutput: ‘Query error: Bad handshake’
Server: MySQL server 5.0.95 (Linux)
Code:
var mysql = require('mysql2');
var config = {
host: '127.0.0.1',
user: 'user',
password: 'password',
database: 'database',
typeCast: false,
supportBigNumbers: true,
bigNumberStrings: true,
insecureAuth: true
}, c;
function doConnect() {
c = mysql.createConnection(config);
c.connect(function(err) {
console.log('Client connected');
});
c.on('error', function(err) {
if (err.code === 'PROTOCOL_CONNECTION_LOST') {
console.log('Disconnected -- reconnecting ...');
doConnect();
} else
throw err;
});
}
function doQuery() {
var count = 0;
console.log('starting query ...');
c.query('select * from foo')
.on('error', function(err) {
console.log('Query error: ' + err);
})
.on('result', function(row) {
++count;
})
.once('end', function(info) {
console.log('Query finished successfully');
console.log(count + ' rows');
});
}
doConnect();
doQuery();
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:35 (23 by maintainers)
Top Results From Across the Web
Sequelize Bad Handshake error - mysql - Stack Overflow
I have a new azure MySQL server and I am trying to use that with my existing Nodejs app. When I try to...
Read more >Cannot connect from nodejs - MSDN - Microsoft
Upgrade the user password or use the {insecureAuth: true} option. ... message: 'Bad handshake' } { [Error: ER_HANDSHAKE_ERROR: Bad ...
Read more >Receive "Bad handshake" error when connect MSQL in Azure ...
When I use Login script in database action scripts, MySQL cannot be connected. My node code is as follows: function login(userName, password ...
Read more >[MXS-2525] before upgrade to 2.3, all works well ,after ...
Upgrade the user password or use the {insecureAuth: true} option ... mysql_error = Bad handshake, mysql_errno = 1045.
Read more >Node-red-node-mysql 0.0.19 "ER_HANDSHAKE_ERROR
MySQL "bad handshake" after entering password. mysql ... @dceejay Dave, is there a minimum level of MySQL that node-red-node-mysql supports?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I should note that the same code works with the ‘mysql’ module.
@sidorares I am getting an empty
authSwitchHandlerParams.pluginName
when trying to implement what you suggested.marker
has a value of0xfe
,asr
is