Mac OS下如何停止本地Postgres服务(Docker服务正常运行)
停止本地Postgres服务的操作方法
根据不同操作系统,停止本地Postgres服务的命令和步骤如下:
Linux 系统
使用 systemd(主流发行版如Ubuntu、CentOS 7+)
- (可选)先确认服务状态:
sudo systemctl status postgresql - 停止服务:
sudo systemctl stop postgresql - (可选)禁止开机自动启动:
sudo systemctl disable postgresql
如果你的Postgres是指定版本的集群(如postgresql@14-main),替换命令中的服务名即可,比如sudo systemctl stop postgresql@14-main
使用 init.d(旧版发行版)
- 停止服务:
sudo /etc/init.d/postgresql stop
macOS 系统
Homebrew 安装的Postgres
- 停止服务:
brew services stop postgresql - (可选)查看服务状态:
brew services list
Postgres.app 安装的Postgres
- 点击菜单栏中的Postgres图标,选择「Stop」;或者打开Postgres应用界面,直接点击停止按钮。
Windows 系统
通过图形界面
- 按下
Win + R,输入services.msc打开服务管理器 - 在列表中找到Postgres服务(名称通常为
postgresql-x64-xx,xx对应你的Postgres版本号) - 右键点击服务,选择「停止」
通过命令提示符(需管理员权限)
net stop postgresql-x64-xx
将命令中的xx替换为你的Postgres实际版本号
内容的提问来源于stack exchange,提问作者Sairam Gourishetty
相关产品推荐
相关产品推荐

