0

I have updated my node version, and now I can't access to my DB with my app. I tried many things: -Change rout to 127.0.0.1. -add my port number 3306 -add socketPath: '/Applications/MAMP/tmp/mysql/mysql.sock' -kill node running And probably others, but I always have an error. Actually, I have this one while running this code. Error:

disconnected
error: connect ECONNREFUSED ::1:3306

My code who was working before:

const mysql = require('mysql');

const db = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "",
    database: "discord"
});
if (db.state === 'disconnected') {
    db.connect(function (err) {
        if (err) { return console.error('error: ' + err.message); }
        console.log('Connected to the MySQL server.');
    });
}
console.log(db.state);
module.exports = db

1 Answers1

0

My issue was the version of discord.js because I have updated it as well. I've changed it in my package.json for the one I used before and everything is working well. It will be hard to update all my app to the new version. If you have any recommendation to update it easily without running into multiple issues, I'm here !