Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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"?
share|improve this question
up vote 2 down vote accepted

How about an alias for psql?

alias psql="psql --host localhost"

Alternatively you could set the PGHOST environment variable.

share|improve this answer
    
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 '10 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 '10 at 10:55
    
There's PGHOST too.. Modified the answer – Joril Nov 23 '10 at 10:58

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.

share|improve this answer

You must log in to answer this question.

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