Scenario
If MySQL 8.0 used, there is an error caused often when starting the CabloyJS backend service: nodejs.ER_NOT_SUPPORTED_AUTH_MODEError
Reason
Because MySQL 8.0 provides a new authentication plugin caching_sha2_password
, however, the latest MySQL NodeJS module does not fully support the caching_sha2_password
, resulting in the authentication error when connecting to the databse
https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html
Solution
For existing user
Modify the password of user root
with mysql_native_password
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
For new user
Create a new user with mysql_native_password
CREATE USER 'newuser'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Comments: