3.2. Starting the Interactive Monitor (psql)

Assuming that your site administrator has properly started the postmaster process and authorized you to use the database, you (as a user) may begin to start up applications. As previously mentioned, you should add /usr/local/pgsql/bin to your shell search path. In most cases, this is all you should have to do in terms of preparation.

Two different styles of connections are supported. The site administrator will have chosen to allow TCP/IP network connections or will have restricted database access to local (same-machine) socket connections only. These choices become significant if you encounter problems in connecting to a database, since you will want to confirm that you are choosing an allowed connection option.

If you get the following error message from a Postgres command (such as psql or createdb):

% psql template1
psql: connectDBStart() -- connect() failed: No such file or directory
        Is the postmaster running locally
        and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
    
or
% psql -h localhost template1
psql: PQconnectPoll() -- connect() failed: Connection refused
        Is the postmaster running (with -i) at 'localhost'
        and accepting connections on TCP/IP port 5432?
    
it is usually because

If you get the following error message:

FATAL 1:Feb 17 23:19:55:process userid (2360) != database owner (268)
    
it means that the site administrator started the postmaster as the wrong user. Tell him to restart it as the Postgres superuser.