In PostgreSQL, the “psql command not found” error or the “psql” is not recognized as an internal or external command arises
Because of the following reasons:
- Postgres is not installed on the Machine.
- The Path for Postgres tools is not set on our system.
The stated error can be fixed either by installing PostgreSQL or by setting the environment variable for the Postgres tools.
[UAT@postgres ~]$ dropdb UATDB;
-bash: dropdb: command not found
Maybe Your $PATH variable doesn't contain the default paths? echo $PATH should give something like:
# locate dropdb
/usr/local/pgsql/bin/dropdb
You may set the PATH variable with this command
# export PATH=/usr/local/pgsql/bin:$PATH
[UAT@postgres ~]$ dropdb UATDB;
Its working now.