-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d62a331
commit 04e8fc9
Showing
2 changed files
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
const mysql = require('mysql'); | ||
require('dotenv').config(); | ||
|
||
const connection = mysql.createPool({ | ||
const dbConfig = ({ | ||
database: process.env.DB_DATABASE, | ||
host: process.env.DB_HOST, | ||
user: process.env.DB_USER, | ||
password: process.env.DB_PASSWORD | ||
}); | ||
|
||
const connection = mysql.createPool(dbConfig); | ||
|
||
module.exports = connection; |
04e8fc9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2023.05.20 에러 해결 : PROTOCOL_PACKETS_OUT_OF_ORDER
원인
DB wait_timeout : 8시간(default), (8시간 동안 DB에 쿼리 접속 없으면 자동으로 DB 서버 죽음)
해결
.createConnection => .createPool
참고
mysqljs/mysql#2534
https://stackoverflow.com/questions/73957523/expressjs-with-mysql-protocol-packets-out-of-order
https://webaura.tistory.com/entry/NodeJS-Mysql-%EC%97%B0%EA%B2%B0%ED%95%98%EA%B8%B0-Mysql-createPool