์๋ ํ์ธ์,
MySQL ์๋ฒ v5.7.x์์ ๊ธฐ๋ณธ strict mode
๋ฅผ ์ฐํํ๊ธฐ ์ํด sql_mode
์ NO_ENGINE_SUBSTITUTION
๋ก ์ค์ ํ๊ณ ์ถ์ต๋๋ค.
MySQL ํด๋ผ์ด์ธํธ ์ฝ์์์ SHOW VARIABLES LIKE 'sql_mode';
๋ฅผ ์
๋ ฅํ์ฌ sql_mode
MySQL ๋ณ์๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
NO_ENGINE_SUBSTITUTION
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
ํ์ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ์ /etc/mysql/my.cnf ํ์ผ์์ mysqld ์น์
์ ์์ ํ๋ ๊ฒ์
๋๋ค.
sql_mode='NO_ENGINE_SUBSTITUTION'
๊ทธ๋๋ DB ์๋ฒ ์์ค์ด ์๋ ์น ์์ฉ ํ๋ก๊ทธ๋จ ์์ค์์ ์ ์งํ๊ณ ์ถ์ต๋๋ค. ์กฐ์ธ์ ๋ถํ๋๋ฆฝ๋๋ค.
๊ฐ์ฌ!
์๋ ํ์ธ์ @ rhys-vdw,
์์์ ์ธ๊ธ ํ ๊ฒฐ๊ณผ๋ฅผ ์ป๋ ๊ณต์์ ์ธ ๋ฐฉ๋ฒ์ธ์ง๋ ๋ชจ๋ฅด๊ฒ ์ง๋ง ์ฐ๊ฒฐ ์ค์ ์ pool
์น์
์์ afterCreate
ํจ์๋ฅผ ์ฌ์ ์ํ๋ ๊ฒ์ด ๋์๊ฒ ํธ๋ฆญ์ ์ ๊ณตํฉ๋๋ค. ์ถ์ฒ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
dbase: {
client: 'mysql',
connection: {
socketPath: '/var/run/mysqld/mysqld.sock',
database : 'db_name',
user: 'db_username',
password : 'db_password',
timezone: 'UTC',
charset: 'utf8mb4_unicode_ci',
supportBigNumbers:true
},
pool: {
min: 2,
max: 10,
afterCreate: function(conn, cb) {
conn.query('SET sql_mode="NO_ENGINE_SUBSTITUTION";', function (err) {
cb(err, conn);
});
}
}
}
์น์ ํ๋,
๋ฃจ์นด
๊ฐ์ฌํฉ๋๋ค @lanceschi , ๋๋ ํด๊ฒฐ์ฑ ์ด ๋ฌด์์ธ์ง
์ฝ๋ฐฑ์ด ๋ฌธ์ํ๋์ด ๋ซํ
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์๋ ํ์ธ์ @ rhys-vdw,
์์์ ์ธ๊ธ ํ ๊ฒฐ๊ณผ๋ฅผ ์ป๋ ๊ณต์์ ์ธ ๋ฐฉ๋ฒ์ธ์ง๋ ๋ชจ๋ฅด๊ฒ ์ง๋ง ์ฐ๊ฒฐ ์ค์ ์
pool
์น์ ์์afterCreate
ํจ์๋ฅผ ์ฌ์ ์ํ๋ ๊ฒ์ด ๋์๊ฒ ํธ๋ฆญ์ ์ ๊ณตํฉ๋๋ค. ์ถ์ฒ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.์น์ ํ๋,
๋ฃจ์นด