Home > Software engineering >  Heroku is not connecting to database NodeJS and Mysql
Heroku is not connecting to database NodeJS and Mysql

Time:05-18

last week I created a Node server with MySQL. Everything went fine. I was using the configvars to connect and made the whole mobile app with the endpoints.

Suddenly, today, Heroku decided to close the connection to MySQL database (ClearDB) and throw status 503 and Connection lost.

const mysql = require('mysql');

const db = mysql.createPool({
    connectionLimit : 120, 
    host     : 'hostFromHeroku.cleardb.net',
    user     : 'user',
    password : 'password',
    database : 'databaseName',
    debug    :  false
});

db.getConnection((err,connection)=> {
    if(err)
    throw err;  //THIS LINE THORS THE ERROR
    console.log('Database connected successfully');
    connection.release();
  });

module.exports = db;

This is the HEroku console

enter image description here

I tried to connect dozens of times again and again... Dont know whats wrong.

I checked the clearDB portal and noticed that on the portal the connection dissapeared. Tried also to connect with MySQL workbench but the connection still cannot be established...

enter image description here

In the figure above there are still no connections... Checked the credentials few dozens of times.... Any ideeas? If anyone wants more pieces of code please let me know

Thanks, Daniel

CodePudding user response:

I am currently having the same issue with ClearDB heroku using Python/Django and it started today as well.

I do believe this is an issue with ClearDB or perhaps Heroku and not on your/our application side. See if you can connect to the database using some client like MySQlWorkbench for example. It probably won't work either.

I opened a ticket with both heroku and clearDB. I suggest you do the same. They must have messed up something

CodePudding user response:

ClearDB is currently experiencing some issues.

Having the same issue over here that I'm unable to connect to my database using TablePlus/Sequel with the following error message:

Lost connection to MySQL server at 'reading initial communication packet', system error: 0

And the Status/Dashboard indicates that the database is up and running.

Created an support ticket and got the following response:

Team is still working on the issue. We will update you once we have next update.

  • Related