Mac 上的 PostgreSQL 无法识别用户密码

PostgreSQL on Mac doesn't recognize users password

我尝试了其他帖子和 SO 问题的许多建议,但 none 似乎可以解决问题。我刚刚用 brew install 安装了 PostgreSQL,然后 运行 initdb 命令。输出表明该用户将用于数据库,但是,该用户始终显示为 mac 用户。我可能遗漏了什么?

控制台输出:

createdb: could not connect to database template1: FATAL: password authentication failed for user "macuser" 
Users-MBP:~ macuser$ 

只需通过以下操作删除已安装的 postgresql。

删除以前版本的 PostgreSQL brew uninstall --force postgresql 删除 Postgres 的所有文件 rm -rf /usr/local/var/postgres

从 Postgresql 下载 macOS 包并安装。

https://www.postgresql.org/download/macosx/

默认用户为 postgres,安装时需要密码字段