Wednesday, December 7, 2016

How to run psql script

If you have a postgres database named myDatabase 
By user user with password password.

First need to set up the path for psql.exe which exists in the %Postgres_home_directory%\bin.
Then Push WIN ÿ button on your keyboard, in appeared window type "cmd", then ENTER to open your command prompt.
There go to the directory where your script is, using cd directoryadress/ ENTER.
In this folder type myscript psql -h localhost -U user -f cms-tables.psql myDatabase.
-h localhost - if you work locally
-p 5433 - if port of database is not default

No comments:

Post a Comment