when i create a new user, but it cannot login the database.
I do that like this:
[email protected]:/home/XXX$ createuser dev Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) y
then create a database:
[email protected]:/home/XXX$ createdb -O dev test_development
after that, I try
psql -U dev -W test_development to login, but get the error:
psql: FATAL: Peer authentication failed for user "dev"
I tried to solve the problem but failed.
This question is related to
psql -U user_name -h 127.0.0.1 -d db_name
-Uis the database user name
-his the hostname/IP of the local server, thus avoiding Unix domain sockets
-dis the database name to connect to
This is then evaluated as a "network" connection by Postgresql rather than a Unix domain socket connection, thus not evaluated as a "local" connect as you might see in
local all all peer