PostgreSQL – Can’t Connect to PgBouncer Administration Database

pgbouncerpostgresqlpostgresql-9.5

I installed pgbouncer and I setup the pgbouncer.ini and my application can connect to pgbouncer and make queries.

But when I try to connect to the virtual administration database of pgbouncer by using the following command

psql -p 6543 -U postgres pgbouncer

I get the following message

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.6543"?

Best Answer

Try with host in your connection string. For example, if you used listen_addr = 127.0.0.1 in your config file, then use:

psql -h 127.0.0.1 -p 6543 -U postgres pgbouncer