mac homebrew postgresql 服务异常中断

1. 断开连接

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
// 9.6 
brew services stop postgresql
 

2. 删除/usr/local/var/postgres中的postmaster.pid

rm /usr/local/var/postgres/postmaster.pid

3. 查看是否删除postmaster.pid

ls /usr/local/var/postgres
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

    /usr/local/Cellar/postgresql/9.4.4/homebrew.mxcl.postgresql.plist: Could not find specified service

   

// 9.6
brew services start postgresql
 

4. 重新启动

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
// 9.6 
brew services start postgresql

一键复制

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
rm /usr/local/var/postgres/postmaster.pid
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  
// 9.6  
brew services stop postgresql
rm /usr/local/var/postgres/postmaster.pid
brew services start postgresql

相关推荐