[MySQL] Error: ER_NOT_SUPPORTED_AUTH_MODE 에러 해결

토이 프로젝트 개발중 새로운 MySQL을 설치하고 백엔드 서버에서 접속하려고 할때 아래와 같은 에러 발생

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
\node_modules\mysql\lib\protocol\Parser.js:437
throw err; // Rethrow non-MySQL errors
^

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Handshake.Sequence._packetToError
at Handshake.ErrorPacket
at Protocol._parsePacket
at Parser._parsePacket
at Parser.write
at Protocol.write
at Socket.<anonymous>
at Socket.<anonymous>
at Socket.emit
at addChunk
--------------------
at Protocol._enqueue
at Protocol.handshake
at Connection.connect
at Object.<anonymous>
at Module._compile
at Object.Module._extensions..js
at Module.load
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true
}

내 개발 환경은 백엔드는 현재 로컬에서 작업중이고 MySQL은 AWS 서버에 올려둔 상태로 AWS에서는 외부 접속의 개념이 됨

아이디는 root에 비밀번호가 11111111을 예로 아래와 같은 쿼리를 실행하여 해결

1
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '11111111';