0

SQL shell(psql) throws me this error when prompting pasword for user postgress psql: error: could not connect to server: fe_sendauth: no password supplied

tried CMD
C:\Users\myuser>psql Password for user myuser: psql: error: could not connect to server: fe_sendauth: no password supplied

C:\Users\myuser>psql -U postgres Password for user postgres: psql: error: could not connect to server: FATAL: password authentication failed for user "postgres"

found this 1. answer :maybe is this isue pgpass.conf file needs to put it to PostgreSQL server and not with pgAdmin (client's dir)?? but cant find such file in explorer

pgAdmin 4 works just fine problem is with psql shell

im on WIN 10 ,anyone have same problem and how to solve it?

PS: i managed to work psql shell by setting pg_hba.config file to

host all all 127.0.0.1/32 md5

for ip4 and ip6 i set trust instade md5 and relaoded Postgress service ,but when i reverted back after seting new pasword to md5 same problem and same error

psql: error: could not connect to server: fe_sendauth: no password supplied

pgAdmin 4 still works

1 Answer 1

1

I've installed and uninstalled many times and I have managed to get the desired result in the picture below...

enter image description here

  1. Install postgres without changing anything, except entering a new password and open the sql shell by entering 'psql' in your Windows search menu.
  2. Inside SQL shell, keep pressing enter until it prompts you for your password which you created on the installer
  3. Type your password here, even though it doesn't look like it is being keyed in and press enter once done.

It should look like...

Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Password for user postgres:
psql (12.2)

WARNING: Console code page (850) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

postgres=# 
  1. Install pgadmin from this link pgadmin, enter the password from psql and you should then see the following...

enter image description here

  1. Click on the server database icon top left and add the password which you entered in psql.
  2. Create a database and get the list.

    postgres=# CREATE DATABASE your_database_name OWNER postgres; #Click enter here
    CREATE DATABASE #result
    postgres=# \l #to get the below datbase list
    

enter image description here

  1. Go back to pg admin, refresh the browser, and click on the server icon.

Note: Should you need to uninstall/re-install you will need to manually delete the folder where you have installed Postgres and pgadmin. This is even after uninstalling from system settings. For some reason, Postgres folder's don't remove entirely even though you select the option.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.