mac使用brew安装postgresql
在您的命令行中运行以下命令:
brew doctor
brew update
安装
在您的命令行中运行以下命令:brew install postgres
你也可以指定版本: brew install postgres@11.17
启动 PostgreSQL 作为服务使用;
brew services start postgresql
停止 PostgreSQL
brew services stop postgresql
如果您卸载 postgresql,那么您可以使用该命令删除其链接;
brew services cleanup
运行命令:createdb 'test'
createuser -s postgres 修复role "postgres" does not exist
brew reinstall readline-仅在需要时
用psql命令测试
使用以下命令连接到您的 postgres:psql
Mac brew 安装Postgres 开机自启动
1.找到homebrew.mxcl.postgresql.plist 文件
mac m1用brew安装postgresql的该文件是在/opt/homebrew/opt/postgresql路径下
2、链接到 ln -s /opt/homebrew/opt/postgresql/homebrew.mxcl.postgresql.plist /Library/LaunchAgents/ 目录下
3、执行 launchctl load /Library/LaunchAgents/homebrew.mxcl.postgresql.plist
4.如果没权限就用sudo加权限
5、重启电脑,查看postgres 进程
ps -ef |grep postgres
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了