Avoiding "Peer authentication failed" error when connecting to a local database with psql
Two options here:
A. Connect to the database with the user postgres
:
$ sudo -u postgres psql
B. Specify the host (-h
option) to force a TCP connection (TCP connections allow password authentication):
$ psql database -U user -h localhost
Enjoy :)
Written by Pablo Torrecilla
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Psql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#