Postgresql in the Windows command line - "psql"

Asked

Viewed 836 times

-2

Good morning, I’m trying to learn a little postgresql and I see some videos where they use commands with the tag "psql", but I already downloaded postgre and when I give a command with "psql" at the beginning he says that the command does not exist, someone knows how to activate the internal command "psql"?

  • This depends on your operating system.

  • What is your operating system? Which installer you used?

  • use Windows, and I downloaded what had on the site postgre, downloaded by enterprisedb

  • The Enterprisedb installer should have installed psql.

  • @anonimo that of the official website also, but here although there was for some reason not created the Path, the program is there... I had not noticed that it was the enterprisedb, but I believe it may be conflict with an earlier version installed

1 answer

1


Being Windows, by your comment, after downloading via https://www.postgresql.org/download/windows/ and install, if the installer did not generate the path in the PATH (environment variables) of Windows then you have to do it manually, look for the path where you installed Postgresql, examples:

C:\Programs and Files\PostgreSQL\12\

Or something like:

C:\Bancos\PostgreSQL\12\

In case I use version 12, depending on the version will only change the folder name, then add "bin", getting:

C:\Programs and Files\PostgreSQL\12\

This is if you have installed in Programs and Files if it is another place it is obvious that you should not copy what is above, it is only to have an idea, it will be like this:

C:\Programs and Files\PostgreSQL\12\bin

Then copy this path and go on environment variables from Windows, go to Computer/ My Computer inside the explorer:

computador no explorer.exe

Click on estates to open the System and in the system click on Advanced system settings

Configurações avançadas de sistema

In the window system properties click on environment variables

propriedades de sistema > variáveis de ambiente

At the bottom on environment variables look for Path and double-click the mouse, or select and go to edit button:

Path em variáveis de ambiente

When opening the window click on new

novo valor em path

Then paste the path from where your postgresql+bin is installed (example: C:\Programs and Files\PostgreSQL\12\bin)

caminho do postgresql no Path

After this done log out and log in or restart Windows (I think you do not need, at least here I just close the cmd or similar).

Ready, pgsql will be available via cli

  • 1

    Thanks William, solved my problem!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.