2

I've installed postgresql 8.3 manually on ubuntu 10.10, using ./configure, make and make install.

It works perfect but when I try to connect it using psql I need to type following cmd,
psql --port --host localhost, my question is, Is there a way that I can omit --host=localhost paramter ??

Error Details when passing only port and not passing --host parameter

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.5431"?

2 Answers 2

3

How about an alias for psql?

alias psql="psql --host localhost"

Alternatively you could set the PGHOST environment variable.

3
  • It may work but its not concrete solution, I want to know something solid like what's default value of --host and from which config. file I can alter the host name.
    – shahjapan
    Nov 23, 2010 at 10:36
  • Psql does read ~/.psqlrc on startup, but it looks like you can only use it to configure the connection, not the login itself...
    – Joril
    Nov 23, 2010 at 10:55
  • 1
    There's PGHOST too.. Modified the answer
    – Joril
    Nov 23, 2010 at 10:58
0

Um, that syntax isn't correct to start: there is nothing being passed to --port. Locally, I get the exact message:

% psql --port --host=localhost
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.0"?

Passing a port (and omitting the --host) should work:

% psql --port 5432
Welcome to psql 8.3.8, the PostgreSQL interactive terminal.

Defining PGDATA, PGHOME, and PGPORT should help with not having to pass arguments to psql.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .