[Node.js 에러] Node.js 와 MySQL 연동시

[Node.js 에러] Node.js 와 MySQL 연동시

1. 에러 내용

code: 'ER_NOT_SUPPORTED_AUTH_MODE',

errno: 1251,

sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',

sqlState: '08004',

fatal: true

다음과 같은 에러가 뜬다.

2. 해결과정

mysql> SELECT Host,User,plugin,authentication_string FROM mysql.user;

나의 경우에는 root에 비밀번호가 설정되지 않아서 해당 오류가 발생하는거 같아서 일단 비밀번호를 설정해 주었다.

mysql> use mysql mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '비밀번호';

3. 결과

nodejs mysql 연결 페이지

mysql 8.0 이상에서 해결 안될경우 plugin type을 수정하는 방향으로 진행하면 될것 같다.

* 도움을 받은 블로그

https://1mini2.tistory.com/88

from http://yourknow.tistory.com/20 by ccl(S) rewrite - 2021-10-07 12:26:28