const mysql = require('mysql');
const connection = mysql.createConnection({
host: '카페24아이디.cafe24.com',
user: '아이디',
password: '패스워드',
database: 'DB명',
port: '3306',
});
connection.connect();
connection.query('SELECT * from books', (error, results, fields) => {
if (error) throw error;
console.log(results);
});
connection.end();
구글링해서 해결 방법 찾음.
https://stackoverflow.com/questions/40303670/nodejs-mysql-query-result-buffer
해결 코드 : port 아래에 넣어줌.
multipleStatements: true,
typeCast: function (field, next) {
if (field.type == 'VAR_STRING') {
return field.string();
}
return next();
}
728x90
300x250