Reputation: 672
I'm starting at Node.js and i'm trying to make a simple connection with Sequelize based on its documentation (http://docs.sequelizejs.com/manual/installation/getting-started.html#installation). Here my db.js file :
const Sequelize = require('sequelize')
const db = new Sequelize('chat','root','root',{
host: 'localhost',
port: 3306,
dialect: 'mysql'
});
db
.authenticate()
.then(() => {
console.log('Connection has been established successfully.');
})
.catch(err => {
console.error('Unable to connect to the database:', err);
});
When executing this code, I have no success nor error message, just a message indicating 'String base operators deprecated' but nothing important i think.
I tried changing localhost to 127.0.0.1, remove port number and multiples thread but i'm stucked here...
Upvotes: 0
Views: 3454
Reputation: 10844
Tested your code and all seemed to work fine, it connected successfully to the database instance I have running.
You might want to ensure mysql2
package is installed. Also check that the database chat
has been created in MySQL workbench, and ensure the password is correct.
Upvotes: 1