I'm coding a simple "connect to db" program in Node.js using the pg
module.
Until yesterday, everything was working fine, but now for some reason this error appears:
error: password authentication failed for user "ezert"
I don't understand what is going on, because I know the password used in the script is correct.
Full code:
const { Client } = require('pg'); // quando definido entre parêntesis, declara-se que se trata de um contrutor
let connectionURL = 'postgresql://ezert:<MY PASSWORD>@localhost:5432/mydb';
const client = new Client({
connectionURL: connectionURL
});
client.connect();
client.query("SELECT * FROM my_table", function (err, result) {
if (err) {
console.log('[ERROR]:\n' + err);
return;
}
console.log('[RESULT]:');
console.log(result.rows);
return;
});