ER_ACCESS_DENIED_ERROR in MYSQL but data are correct

I started getting this error practically overnight without having moved or done anything with MySQL

Error: ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)

This is the code with which I connect to the database, which used to work but suddenly it stopped working

const mysql = require("mysql");
const { promisify } = require("util");
const { database } = require("./keys.js");

const pool = mysql.createPool(database);

pool.getConnection((err, conn) => {
    if (err) {
        if (err.code === "PROTOCOL_CONNECTION_LOST") {
            console.error("closed")
        }
        if (err.code === "ER_CON_COUNT_ERROR") {
            console.error("to much")
        }
        if (err.code === "ECONNREFUSED") {
            console.error("refused")
        }
    };

    if (conn) conn.release();
    console.log("success");
    return;
});

pool.query = promisify(pool.query);

module.exports = pool;

The data with which I connect to the database are correct and I even use them daily to connect to the database from bash.

// keys.js
module.exports = {
    database: {
        host: process.env.MYSQL_HOST,
        user: process.env.MYSQL_USER,
        password: process.env.MYSQL_PASS,
        database: process.env.MYSQL_DATABASE
    }
}