MySQL Error 1045, "Access denied for user ''@'localhost' (using password: NO)"

Viewed 63

for a project i've been working on, a few weeks ago when trying to seed the database, i received the following error:

errno: 1045,
sqlState: '28000',
sqlMessage: "Access denied for user ''@'localhost' (using password: NO)",

i'm using sequelize as the ORM with a .env file. The connection.js file is as follows:

const Sequelize = require('sequelize');
require('dotenv').config();

let sequelize;

if (process.env.JAWSDB_URL) {
  sequelize = new Sequelize(process.env.JAWSDB_URL);
} else {
  sequelize = new Sequelize(
    process.env.DB_NAME,
    process.env.DB_USER,
    process.env.DB_PASSWORD,
    {
      host: 'localhost',
      dialect: 'mysql',
      port: 3306
    }
  );
}

module.exports = sequelize;

It had been working just fine until about 4 weeks ago.

Any pointers anyone has so that i can seed and test out the database would be appreciated.

Vr, Homeschool

0 Answers
Related