首页 > 代码库 > Start/Stop PostgreSQL on Mac

Start/Stop PostgreSQL on Mac


Start PostgreSQL:

sudo -u postgres /Library/PostgreSQL/9.6/bin/pg_ctl -D /Library/PostgreSQL/9.6/data start

Stop PostgreSQL:

sudo -u postgres /Library/PostgreSQL/9.6/bin/pg_ctl -D /Library/PostgreSQL/9.6/data stop

Stop PostgreSQL from auto-starting on reboot:

sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.6.plist 

Make PostgreSQL auto-start on reboot:

sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.6.plist 


Mac启动时,不自动启动postgresql,也可以作为停止postgresql的命令:

 sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.6.plist


自动启动postgresql,也可以作为启动postgresql的命令:

 sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.6.plist


Start/Stop PostgreSQL on Mac