如何在 mac 上找到 PostgresQL 的用户名和密码?

How to find user name and password for PostgresSQL on mac?

如何在 mac 上找到 PostgresQL 的用户名和密码?我不记得我设置了密码和用户名。如何找到 mac 上的默认用户名和密码?

无需密码登录:

sudo -u postgres psql postgres

知道用户名

\du

重置密码:

ALTER USER user_name WITH PASSWORD 'new_password';

user_name 替换为您通过 \du 命令找到的用户名