Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 1 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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.