I keep trying to join mysql database using sequelize,
dbconfig
const Sequelize = require('sequelize')
// Creating new Object of Sequelize
const sequelize = new Sequelize(
'mysql-server',
'root',
'toor', {
// Explicitly specifying
// mysql database
dialect: 'mysql',
// So by default, host is 'localhost'
host: 'localhost'
}
);
module.exports = sequelize
models/index.js
const sequelize = require('../configs/dbConfig');
const {DataTypes} = require('sequelize');
//connect the
sequelize.authenticate()
.then(() => {
console.log('connected to the databse')
})
.catch(err => {
console.log('Error'+ err)
})
but i keep getting this error “ErrorSequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306” on the terminal and on the database i get this error’Could not connect, server may not be running. Unable to connect to localhost ‘
im pretty sure i copied the credentials properly