Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgres 'psql' command is not recognized in windows environment

Tags:

It seems like I have it set up, I have my database.yml using postgres, and I can connect the database with pgadmin III, but when I tried using the psql command to test what version, it says that is is not recognized? Any idea what I should be doing?

I'm using windows and using command prompt with Ruby on Rails. Using PostgreSQL 9.2 installed with the EnterpriseDB one-click installer.

like image 283
hellomello Avatar asked Apr 08 '13 01:04

hellomello


People also ask

Where is psql located Windows?

On Windows, the default data folder is C:\Program Files\PostgreSQL\x.x\data.

How do you check if postgres is installed Windows?

The quick way to verify the installation is through the psql program. First, click the psql application to launch it. The psql command-line program will display. Second, enter all the necessary information such as the server, database, port, username, and password.


1 Answers

Assuming you installed PostgreSQL on Windows with the PostgreSQL "One-click" installer packaged by EnterpriseDB, psql is not added to the PATH automatically. That's partly because adding it to the path could otherwise cause confusion when people have multiple versions of PostgreSQL installed.

You need to specify the full explicit path to psql, eg:

"%PROGRAMFILES%\Postgresql\9.2\bin\psql.exe" 

or add psql to the user PATH environment variable, see eg this guide.

like image 142
Craig Ringer Avatar answered Sep 26 '22 01:09

Craig Ringer