Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restart postgresql on OS X?

People also ask

How do I start PostgreSQL on Mac terminal?

`psql` on Terminal To get to the PostgreSQL terminal, open your terminal, start the database services ( brew services start postgresql) , then run psql . Thank you!

How do you check if postgres is running on Mac?

psql -c "SELECT 1" -d {dbname} > /dev/null || postgres -D /usr/local/var/postgres >postgres. log 2>&1 & if you want to check and start postgres in one go (handy for automation scripts).


Just in case postgres has been installed using homebrew, you can also run below command:

brew services restart postgres

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log restart

/usr/local/var/postgres is the location of the database storage area, and /usr/local/var/postgres/server.log is my log file for postgres. The last word restart is the operative word here. You can also use start to start the service.

You can find the location of the database storage area by running ps aux | grep postgres | grep -- -D


for hba.conf changes to apply you don't need to restart - just reload.

run select pg_reload_conf() in psql

also:

run show data_directory in psql to find your data dir...