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

当遇到Mac上的Homebrew PostgreSQL服务异常中断时,可以尝试断开连接,删除/usr/local/var/postgres中的postmaster.pid文件,确认其已被删除,然后重新启动服务。此过程有助于解决服务无法启动的问题。
1299

被折叠的 条评论
为什么被折叠?



