Server/개발

[Node.js] mysql 연동 issue

sangjun-pro 2022. 4. 25. 16:21

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

 

- 결론

-> mysql 패스워드 플러그인 이슈 ( mysql 8.0 / node v14.18 )

    아래 caching_sha2_password 를 mysql_native_password 로 변경

mysql> select host,user,plugin from mysql.user;

+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | test             | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+

 

mysql> alter user 'test'@'%' identified with mysql_native_password by 'testpassword';
Query OK, 0 rows affected (0.47 sec)

mysql> select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | test             | mysql_native_password | // 변경 확인
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+
5 rows in set (0.00 sec)