When trying to connect server to MySQL using:
const connection = mysql.createConnection({
host: '192.168.99.100',
user: 'root',
password: 'foo123',
database: 'foo_db'
});
Getting:
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgr ading MySQL client
Checked many answer here at StackOverflow. Most of them use (example):
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MyNewPass';
However I get:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MyNewPass'; Query OK, 0 rows affected (0.06 sec)
And the server still doesn't want to connect. Using MySQL 5.7 works fine.
Any ideas how to fix this for MySQL 8?
ADDED:
Just to be crystal clear:
After connecting to MySQL, running:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'foo123';
FLUSH PRIVILEGES;
Restarting Node.js and MySQL container and nothing happens.
I hope you are not using literally the value 'MyNewPass'
, but it surely looks like it. That's supposed to be an example placeholder.
In your case you would have to do:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'foo123';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With