I have a newly created strapi app and tried to connect it with postgresql DB and I have entered the correct credentials but it gives me the errors called
[2022-05-25 09:30:24.315] debug: ⛔️ Server wasn't able to start properly.
[2022-05-25 09:30:24.330] error: password authentication failed for user "user"
error: password authentication failed for user "user"
at Parser.parseErrorMessage (C:\Users\user\OneDrive\Desktop\commerce-
strapi\myshop\node_modules\pg-protocol\dist\parser.js:287:98)
at Parser.handlePacket (C:\Users\user\OneDrive\Desktop\commerce-
strapi\myshop\node_modules\pg-protocol\dist\parser.js:126:29)
at Parser.parse (C:\Users\user\OneDrive\Desktop\commerce-
strapi\myshop\node_modules\pg-protocol\dist\parser.js:39:38)
at Socket.<anonymous> (C:\Users\user\OneDrive\Desktop\commerce-
strapi\myshop\node_modules\pg-protocol\dist\index.js:11:42)
at Socket.emit (node:events:527:28)
at Socket.emit (node:domain:475:12)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
and the database.js file is :
module.exports = ({ env }) => ({
defaultConnection: "default",
connection: {
client: 'postgres',
connection: {
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'),
username: env('DATABASE_USERNAME', 'postgres'),
password: env('DATABASE_PASSWORD', 'lokesh'),
schema: env('DATABASE_SCHEMA', 'public'), // Not required
},
},
});
I have found this database.js file for strapi v4 in a youtube video.
But even if I entered correct credentials it gives me errors I have tried restarting the server soo many time but it didn't work, can anyone help me please.