Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: password authentication failed for user "notesadmin" #21

Closed
dugiwarc opened this issue Dec 22, 2020 · 2 comments
Closed

error: password authentication failed for user "notesadmin" #21

dugiwarc opened this issue Dec 22, 2020 · 2 comments

Comments

@dugiwarc
Copy link

I cloned the repo, and ran npm install
When I access localhost:4000 I get the following error:
error: password authentication failed for user "notesadmin"

@poteto
Copy link
Member

poteto commented Dec 23, 2020

Did you setup the database? Could you share the whole error?

@tiberiu80
Copy link

I had the same error but then i setup db and worked.
I had a problem setting up postgresql db but i fixed it and managed to start the app.
My setup went like this:
Step 1. Create the Database
psql postgres

CREATE DATABASE notesapi;
CREATE ROLE notesadmin WITH LOGIN PASSWORD 'password';
ALTER ROLE notesadmin WITH SUPERUSER;
ALTER DATABASE notesapi OWNER TO notesadmin;
\q
All fine.
Step 2
psql -d postgres -U notesadmin; <--- here i got ' psql: FATAL: Peer authentication failed for user "notesadmin" ' in terminal.
After some quick research i found https://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge which explains why you can't connect with 'notesadmin' user.
I didn't want to change postgresconfig so i did some more research and found https://stackoverflow.com/questions/17443379/psql-fatal-peer-authentication-failed-for-user-dev/17443990 which led me to use
psql -U notesadmin -h 127.0.0.1 -d notesapi which worked
From here i did the following steps and app started
\c notesapi

DROP TABLE IF EXISTS notes;
CREATE TABLE notes (
id SERIAL PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
title TEXT,
body TEXT
);

\q

Step 3. Run the seed script
Finally, run npm run seed to populate some data.
npm start
Hope this save someone's time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants