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.
Related
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.
I forgot my password for an older version of Postgres (I believe v14) and uninstalled it then deleted the remaining files in my program files folder.
I also deleted the environment variable in the path leading to it.
I installed the latest version, v15.
I set the path variable to include C:\Program Files\PostgreSQL\15\bin
v15 works perfectly fine. When I do psql -U postgres
I can log in.
None of my passwords work for it, I get
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "chris"
However, simply typing psql in the Power Shell asks me for an old user, of which I forgot the password (the above user, "chris").
PgAdmin does not have this user listed, nor any databases associated with it, only the new Postgres user with v15.
There probably is no user chris in your new v15 cluster. You'd have to create it:
psql -U postgres
...
postgres#> CREATE ROLE chris LOGIN;
CREATE USER
postgres#> \password chris
Enter new password for user "chris":
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.
EDIT: WINDOWS: Yes Windows. Do not redirect me to answers that specify sudo-ing because, hey, I can't sudo on Windows.
I have just done a fresh install of postgres 11 on Windows and I am getting
C:\Users\J\Documents\Development>psql -U postgres
psql: FATAL: password authentication failed for user "postgres"
password retrieved from file "C:\Users\J\AppData\Roaming/postgresql/pgpass.conf"
Note that I do not get an opportunity to enter a password - i.e. I do NOT get a password prompt. There is a password in the pgpass.conf file. I am running the cmd.exe box as Administrator.
There is a link to psql in the folder created at installation but that is no good either. It identically does not ask for a password.
Any ideas? Thanks in advance.
The password file is documented.
To get a password prompt, locate the file in %APPDATA%\postgresql\pgpass.conf and delete it.
It was probably created automatically by pgAdmin.
If there is an entry in the password file that matches your login, you won't be prompted, and the password is taken from the file. If you delete the file, you will be prompted for a password (if pg_hba.conf is configured accordingly).
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