Password authentication failed for user - postgresql

I am having a problem trying to run psql on my MacOs. The psql command returns the following error:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "luicruz"
How could I fix this?
I try to put my sudo password when the terminal request me the password, but it didn't work. The only password that works is for the default user "postgres" that I set the password when I install the app on my system.
I don't know why the user 'luicruz' was automatically created, I didn't create this user or set a password for this user.
And now I can't use the psql command.
Below is an image showing the login/Group roules of the Pg Admin 4 and also the return of the commands in the terminal

The problem is that the psql command needs to be used in addition to the database name, and I didn't know that. After creating the database, I was able to use the command apart from the psql command.

Related

psql password not typing in terminal windows 11

i want to install psql in my terminal for the first time on windows 11 pc,
when i run psql i will get this Password for user Cullkid: .
And when i tried to enter a password, it wouldn't allow me to tyepe anything there.
i am using progreSQL 15
i watched some videos via youtube and saw that progresql request password when installing but mine doesn't give me the option
first i run
psql --version
and it shows me the result.
secondly i run
psql
and it gives me
Password for user Cullkid:
thirdly if i try typing password, it wouldn't typeout anything
if i hit return without introducing a password, then i get this :
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:password authentication failed for user "Cullkid"

Unable to execute postgres command

I'm having difficulty changing the password associated with the postgres user after installing postgres on my windows 10 machine. My apologies in advance as I'm quite unfamiliar with postgres as well as the commands required to work with it.
I've referenced the approved answer in the below article:
FATAL: password authentication failed for user "postgres" (postgresql 11 with pgAdmin 4)
I'm stuck on the step that requires me to
Connect using psql or pgAdmin4 or whatever you prefer
Run ALTER USER postgres PASSWORD 'fooBarEatsBarFoodBareFoot'
I don't quite understand this step. I've taken the following steps
Open cmd
run psql
The system then asks me for password for username jason. Regardless of what I enter, i get the following message:
psql: error: could not connect to server: FATAL: password authentication failed for user "jason"
At no point do I have an opportunity to enter the following command:
ALTER USER postgres PASSWORD 'fooBarEatsBarFoodBareFoot'
How can I run this command without being asked to enter a password for postgres?
Thanks!
The steps below require that you remember what you did when you installed PostgreSQL.
Locate the data directory where the installation process created the database cluster. By default, that would be a subdirectory of where you installed the software (which is a bad place)
Edit the pg_hba.conf file therein and add this line on top:
host postgres postgres 127.0.0.1/32 trust
Reload or restart PostgreSQL.
Start cmd.exe and enter
psql -h 127.0.0.1 -p 5432 -d postgres -U postgres
If psql is not on your PATH, use the absolute path C:\...\psql.
Use \password to change the password.

run psql after installation

I just installed PostgreSQL on my computer. In some stage of the installation I was requested to define a password (but was not requested to set user). The installation completed successfully. Now I changed directory to C:\Program Files\PostgreSQL\11\bin and write in command line
psql
I got a request for password for user xxx that I use to login to Windows. I tried to enter the password I had defined, but no symbol is shown and the cursor doesn't move. After "Enter" I get message
psql: FATAL: password authentication failed for user "xxx"
So I think that something wrong but I don't know how to fix that.
Login as database user postgres rather than using the default (the user of the same name as the operating system user):
psql -U postgres

fatal: password authentication failed for user "user"

C:\Program Files\PostgreSQL\10\bin>psql -- U "user"
Password:
psql: FATAL: password authentication failed for user "user"
I'm getting the above error when trying to run postgresql from cmd line on windows. However, when I run it from the start menu (using the gui) the password works fine. I'm on a laptop logged in as a user. My IT dept set up this role to have most admin privileges, but not all. So I installed the software as a user when I created the password. I want to use createdb db_name on the command line. What is the proper way to access posgreSQL from windows command line? How do I get to createdb and beyong the authentication issue? I tried changing the pg_hba.conf file also and that didn't work.
C:\Program Files\PostgreSQL\10\bin>psql -U username template1
username is your user to login
template1 is default database

postgresql password authentication failure

I have installed PostreSQL, I have the Heroku toolbox, and I'm still trying to just get started.
From my Windows command prompt, I type psql and it asks for a password, and I type in the one I provided when installing PSQL, and it still gives me:
C:\Users\Tina\Desktop\FriendActivity>psql
Password:
psql: FATAL: password authentication failed for user "Tina"
I have even tried:
C:\Users\Tina\Desktop\FriendActivity>psql -U postgres
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
This is a fresh install. First time trying to use it.
I was trying to follow these steps here:
https://devcenter.heroku.com/articles/heroku-postgresql#local-setup
but
export DATABASE_URL=postgres:///$(whoami)
does not work:
C:\Users\Tina\Desktop\FriendActivity>export DATABASE_URL=postgres:///$(whoami)
'export' is not recognized as an internal or external command,
operable program or batch file.
I have been trying to get this set up to use for a class project that uses a database for a few days now... and I cant seem to get this to work.
the project we are working on is here:
https://github.com/rwprice31/FriendActivity
My part is getting the database functionality working.
You are following instructions written for Linux or Mac OS X. They will not work on Windows.
The Windows equivalent of:
export DATABASE_URL=postgres:///$(whoami)
is
set DATABASE_URL=postgres://localhost/databasename
where you should replace databasename with the name of the database you wish to connect to.
As for:
> psql -U postgres
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
I can only assume that you made a mistake entering the password when you set it up, or you had an old PostgreSQL data directory already in place from a past install.
Either way, you'll need to reset the password. There are many instructions here for doing that, so I won't repeat them.
Regarding:
>psql
Password:
psql: FATAL: password authentication failed for user "Tina"
Presumably there is no user named Tina in PostgreSQL. The installer would usually only create a postgres user when installed.