mysql: Error: ER_NOT_SUPPORTED_AUTH_MODE with auth_socket
Yesterday I upgraded my ubuntu distribution an MySql Server was updated too.
But when I connect I get this error
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
My connection code:
var mysql = require('mysql');
var connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'test_db',
// insecureAuth : true,
});
connection.query('SELECT * FROM users', function(err, rows, fields) {
if (err) throw err;
});
I tried to set insecureAuth: true
but no changes
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 6
- Comments: 29 (12 by maintainers)
Links to this issue
- Error installing Ghost on VPS with MySQL - Installation - Ghost Forum
- Ghost install fails with MariaDB "ER_NOT_SUPPORTED_AUTH_MODE" - Developer help - Ghost Forum
- Connecting to MySQL | SeekWell Help Center
- node.js - MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client - Stack Overflow
Problem solved!
http://stackoverflow.com/a/36234358/1431224
Changing plugin to mysql_native_password solved the problem 😃!
https://github.com/mysqljs/mysql/issues/1507#issuecomment-242885003 worked for me. Don’t forget to
flush privileges;
after.https://github.com/mysqljs/mysql/issues/1507#issuecomment-242885003 worked for me, too. 👯♂️
and need flush privileges; after follow https://github.com/mysqljs/mysql/issues/1507#issuecomment-271690367
@joe-angell relatively easy to add with mysql2 and
authSwitchHandler
- see https://github.com/sidorares/node-mysql2/blob/master/documentation/Authentication-Switch.mdActually I didn’t try to figure out what was the old value, I just liked the part when I changed the plugin then it worked 😄
Thanks all guys for your concern
This one worked for me:
Just ran into the same issue.
The root user by default (if you didn’t set any password during installation) appears to be:
In my case, I solved the problem by fixing my nodejs code to stop using root user to connect.
Haha, we all replied at the same time 😃 I’m not sure why mine worked out of the box, but glad to get this figured out.