프로그래밍/Node.js
[Sequelize] DB연결 에러
L.Joey
2023. 8. 7. 22:45
DB에 접속하지 못하여 발생한 에러
확인해본 것들
- Mysql port number ( 3306 이 아닌지 확인 )
- database 이름
- GUI로 mysql 접속 가능한지
connect ECONNREFUSED ::1:3306 문구에서
- ::1?? https://stackoverflow.com/questions/4611418/what-is-ip-address-1
- The simple answer is that: ::1 is the compressed format of IPV6 loopback address 0:0:0:0:0:0:0:1. It is the equivalent of the IPV4 address 127.0. 0.1
const sequelize = new Sequelize('database', 'username', 'password', {
host: 'localhost', // <--- 에러일으킴
dialect: 'mysql'
});
host 수정!!
const sequelize = new Sequelize('database', 'username', 'password', {
host: '127.0.0.1', // <--- 해결
dialect: 'mysql'
});