[英]psql cannot start on Mac M1 + Monterey
On my new Mac M1 (Monterey), I tried to install Postgres with brew:在我的新 Mac M1 (Monterey) 上,我尝试用 brew 安装 Postgres:
brew install postgresql@14
After installation is completed, I can see that the service is running:安装完成后,可以看到服务正在运行:
brew services list
> postgresql@14 started johndoe ~/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist
Problem is when I try to issue the psql command I get the following:问题是当我尝试发出 psql 命令时,我得到以下信息:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: role "johndoe" does not exist
I tried to uninstall postgres and reinstall it with brew but the same thing occurs.我试图卸载 postgres 并用 brew 重新安装它,但同样的事情发生了。 Can someone help?
有人可以帮忙吗?
You should create the database user johndoe
by您应该通过以下方式创建数据库用户
johndoe
createuser -Upostgres -d johndoe
first.第一的。 The
-d
flag allows the new user to create new databases. -d
标志允许新用户创建新数据库。 This can be done by这可以通过
createdb -Ujohndoe mydb
After that you can connect to the new database as user johndoe
by之后,您可以通过以下方式以用户
johndoe
的身份连接到新数据库
psql -Ujohndoe -dmydb
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.