
See the accepted answer and the comments of "Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails". Psql (or psql -p if you have more than one PostgreSQL) Change any local user from peer to md5, usually:Īdd a postgres pw with the power of your Linux pw only: sudo su postgres.This way is even easier because you will need to change the pg_hba.conf only once: Option 2: Use md5, no trust needed (recommended) See this solution in detail at the second answer of 'Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails'.
Enroute 4 password here password#
instead change local all from peer to md5 - which means that a right password is enough to login.NOTE: Remember to change the METHOD back to md5 or other auth-methods listed here after changing your password (as stated above).īetter change only postgres to trust in the pg_hba.conf, then access your db with postgres super user and add other users and passwords with the power of the postgres super user, then change all other peer to md5. Here is an example of the pg_hba.conf file (METHOD is already set to trust): # TYPE DATABASE USER ADDRESS METHOD Restart PostgreSQL again to bring the changes to effect. Remove the line you added to pg_hba.conf or change it back Run ALTER USER postgres PASSWORD 'fooBarEatsBarFoodBareFoot' Restart the PostgreSQL service from the Services control panel ( start->run->services.msc)Ĭonnect using psql or pgAdmin4 or whatever you prefer (You can ignore comments, lines beginning with #). You can add the line if it isn't there just insert host all postgres 127.0.0.1/32 trust before any other lines. Your user account might not be able to do so until you use the security tab in the properties dialog to give yourself that right by using an admin override.Īlternately, find notepad or notepad++ in your start menu, right click, choose "Run as administrator", then use File->Open to open pg_hba.conf that way.Įdit it to set the "host" line for user "postgres" on host "127.0.0.1/32" to "trust". If necessary, set the permissions on it so that you can modify it. That will give you the path of nf at the bottom of the window ( official documentation).Īfter knowing the location, you can open this file and edit it to your liking.įind your pg_hba.conf, usually located under C:\Program Files\PostgreSQL\9.1\data\pg_hba.conf While there are several web-based tools that can rate the strength of your password, you should only choose those you can trust with your credentials. You can access your nf via pgAdmin -> Files -> open nf The Top 4 Password Strength Checkers According to the 2019 Verizon Data Breach Report, 80 percent of hacking-related breaches are linked to weak or reused passwords. The default authentication mode for PostgreSQL is set to ident.
