Linux – Running psql in Linux Command Line

linuxpostgresqlUbuntu

I've just installed Postgres9 and it is up and running without any issues. There is one thing however that is confusing me:

If I type /usr/local/pgsql/bin/psql test then postgres command line loads and I can use it as expected, however…

If I cd /usr/local/pgsql/bin then type psql test I get the following error:

The program 'psql' is currently not installed. To run 'psql' please ask your administrator to install the package 'postgresql-client-common'

Does anyone know why? (please don't say install postgresql-client-common as this doesn't solve the problem)

Best Answer

The directory /usr/local/pgsql/bin is not in your PATH (and neither is . - which is a good thing for security reasons). Simply run it like this if you're in that directory:

./psql test

which says run psql from the current directory (./).