0

I recently reformatted my server and did the usual back up. However ever since I've gotten my server back online i'm facing an error on my database. I manually checked if the tables are working and they are; I can access them on phpmyadmin. I'm checking if the database is properly connected; I even tried reconnecting the database when it breaks down; however I'm still facing the same error. I've tried pool connections and it was no help. I've tried manually reconnecting to the database upon errors and it still produces the same error. Here is my code:

/* MYSQL CONNECTION */
var db;
function choke(){
     /* CREATE THE CONNECTION */
     let db = mysql.createConnection({
       host: "127.0.0.1",
       user: "admin",
       password: "",
       multipleStatements: true
     });
    db.connect(err=>{
    if(err) {
        console.log(err);
    } 
    console.log("DB connected Successfully!!")
})
    /* ERROR HANDLER */
    db.on('error', function(err){
        if(err.code == 'PROTOCOL_CONNECTION_LOST'){
            /* RECURSE FUNCTION */
            choke();
        }else{
            /* DATABASE ERROR. */
            console.log(err)
        }
    });
}
choke();

The error I recieved was:

code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR',
fatal: false

The code was all working fine before the reformat so it has something to do with the settings of the database rather than a coding error.

Rah1337
  • 1
  • 4
  • Does this answer your question? [Node JS Mysql PROTOCOL ENQUEUE AFTER FATAL ERROR](https://stackoverflow.com/questions/31549193/node-js-mysql-protocol-enqueue-after-fatal-error) – segFault Feb 28 '23 at 04:21
  • I tried the solutions posted in that link but none of them worked; I recieved the same error after trying the express session code; the handleDisconnect code and the SQL statements. – Rah1337 Feb 28 '23 at 04:39
  • 1
    The password was incorrect. =_=. – Rah1337 Feb 28 '23 at 05:23

0 Answers0