작성
·
431
0
MySQL Workbench 까지 확인 됐고요.
(3) 번 실행 하면 아래 에러가 발생합니다.
PS C:\Users\esc0\Desktop\saju\saju-backend-nodejs> npm run start
> saju-backend-nodejs@1.0.0 start
> cross-env NODE_ENV=prod PORT=3000 node server.js
3000 번 포트에서 대기중
ConnectionError [SequelizeConnectionError]: Unknown database 'saju-db-prod'
at ConnectionManager.connect (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:102:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ConnectionManager._connect (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:220:24)
at async C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:174:32
at async ConnectionManager.getConnection (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:197:7)
at async C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\sequelize.js:301:26
at async MySQLQueryInterface.tableExists (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\dialects\abstract\query-interface.js:102:17)
at async Function.sync (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\model.js:939:21)
at async Sequelize.sync (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\sequelize\lib\sequelize.js:373:9) {
parent: Error: Unknown database 'saju-db-prod'
at Packet.asError (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\packets\packet.js:728:17)
at ClientHandshake.execute (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\commands\command.js:29:26)
at Connection.handlePacket (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\connection.js:456:32)
at PacketParser.onPacket (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\connection.js:85:12)
at PacketParser.executeStart (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket.<anonymous> (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\connection.js:92:25)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10) {
code: 'ER_BAD_DB_ERROR',
errno: 1049,
sqlState: '42000',
sqlMessage: "Unknown database 'saju-db-prod'",
sql: undefined
},
original: Error: Unknown database 'saju-db-prod'
at Packet.asError (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\packets\packet.js:728:17)
at ClientHandshake.execute (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\commands\command.js:29:26)
at Connection.handlePacket (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\connection.js:456:32)
at PacketParser.onPacket (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\connection.js:85:12)
at PacketParser.executeStart (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket.<anonymous> (C:\Users\esc0\Desktop\saju\saju-backend-nodejs\node_modules\mysql2\lib\connection.js:92:25)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10) {
code: 'ER_BAD_DB_ERROR',
errno: 1049,
sqlState: '42000',
sqlMessage: "Unknown database 'saju-db-prod'",
sql: undefined
}
}
C:\Users\esc0\Desktop\saju\saju-backend-nodejs\server.js:29
throw new Error("Mysql 연결 에러!");
^
Error: Mysql 연결 에러!
at C:\Users\esc0\Desktop\saju\saju-backend-nodejs\server.js:29:13
at processTicksAndRejections (node:internal/process/task_queues:96:5)
답변 3
1
0
오타가 있었고요 수정했더니 ... 또 에러가...
PS C:\Users\esc0\Desktop\saju\saju-backend-nodejs> npm run start
> saju-backend-nodejs@1.0.0 start
> cross-env NODE_ENV=prod PORT=3000 node server.js
node:events:368
throw er; // Unhandled 'error' event
^
Error: listen EACCES: permission denied 0.0.0.0:3000
at Server.setupListenHandle [as _listen2] (node:net:1317:21)
at listenInCluster (node:net:1382:12)
at doListen (node:net:1520:7)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1361:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EACCES',
errno: -4092,
syscall: 'listen',
address: '0.0.0.0',
port: 3000
}
0
안녕하세요. 아래 2가지 내용 확인 부탁드려요.
오타 확인 부탁드려요. 강의 내용은 saju-db-prod 가 아닌 saju_db_prod 입니다.
3가지 내용 확인 : AWS RDS 생성, MySQL Workbench 확인, .env 파일 확인
3000 포트를 이미 사용중인데 다시 실행해서 생긴 에러로 보입니다. 아래 내용 확인 부탁드려요.
기존 3000 포트를 사용하는 것을 종료합니다. 종료하기 어렵다면 컴퓨터 재시작을 합니다.
백엔드 코드에서 포트를 3000 번에서 3001 번으로 변경해서 실행합니다.