IT/개발

MySQL connection failed: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client 해결 2

jeces1 2024. 5. 9. 10:44
반응형

MySQL connection failed:  Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Sequence._packetToError (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Handshake.ErrorPacket (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
    at Protocol._parsePacket (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    --------------------
    at Protocol._enqueue (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Protocol.handshake (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/protocol/Protocol.js:51:23)
    at Connection.connect (/Users/user/Desktop/ManuServer/node_modules/mysql/lib/Connection.js:116:18)
    at Object.<anonymous> (/Users/user/Desktop/ManuServer/ManuServ.js:16:12)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  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

node.js 의 코드에서 모듈을 'mysql'이 아닌 'mysql2'를 가져오면 해결된다.

MySQL과 MySQL2 의 차이로

1. MySQL은 Promise를 지원하지 않으며, Callback 기반으로 동작

2. MySQL2는 Promise를 지원하며, Callback과 Promise를 모두 활용

 

반응형