ERROR: Peer authentication failed for user "postgres"
Solution:
The problem is in your pg_hba file.
You can locate it inside /etc/postgresql/9.1/main.
If you are not able to look at inside it then search location with this command. This will help you a lot!!
locate pg_hba
Then open this file with this command and press i for insert.
vi pg_hba.conf
If it will give alert like read only file then change permission with this command:
sudo chmod 666 pg_hba.conf
Then again open file with
vi pg_hba.conf
And change this line :
# Database administrative login by Unix domain socket
local all postgres peer
with this line:
# Database administrative login by Unix domain socket
local all postgres md5
If this not work then use this for trust:
# Database administrative login by Unix domain socket
local all postgres trust
then restart postgresql with this command:
sudo service postgresql restart
And its working fine!!! Have a fun!!!
Solution:
The problem is in your pg_hba file.
You can locate it inside /etc/postgresql/9.1/main.
If you are not able to look at inside it then search location with this command. This will help you a lot!!
locate pg_hba
Then open this file with this command and press i for insert.
vi pg_hba.conf
If it will give alert like read only file then change permission with this command:
sudo chmod 666 pg_hba.conf
Then again open file with
vi pg_hba.conf
And change this line :
# Database administrative login by Unix domain socket
local all postgres peer
with this line:
# Database administrative login by Unix domain socket
local all postgres md5
If this not work then use this for trust:
# Database administrative login by Unix domain socket
local all postgres trust
then restart postgresql with this command:
sudo service postgresql restart
And its working fine!!! Have a fun!!!
0 comments:
Post a Comment