Macos psql:致命:角色“;vimarshchaturvedi“;不存在。Postgres.app安装
我正在开发OS X El Capitan版本10.11.3 我下载了Postgres应用程序并运行了该应用程序 顶部的大象图标显示版本9.6.1.0(9.6.1.0) 当我点击“OpenPSQL”时,我在终端上得到以下输出Macos psql:致命:角色“;vimarshchaturvedi“;不存在。Postgres.app安装,macos,postgresql,authentication,postgresql-9.6,Macos,Postgresql,Authentication,Postgresql 9.6,我正在开发OS X El Capitan版本10.11.3 我下载了Postgres应用程序并运行了该应用程序 顶部的大象图标显示版本9.6.1.0(9.6.1.0) 当我点击“OpenPSQL”时,我在终端上得到以下输出 $ '/Applications/Postgres.app/Contents/Versions/9.6/bin'/psql -p5432 psql: FATAL: role <username> does not exist 再搜索一点后,我运行了以下命令:
$ '/Applications/Postgres.app/Contents/Versions/9.6/bin'/psql -p5432
psql: FATAL: role <username> does not exist
再搜索一点后,我运行了以下命令:
psql -h localhost -U postgres
postgres=#
博士后的外壳打开了。有人能解释发生了什么吗?在没有任何给定用户名(
-U…
)的情况下启动psql会尝试使用与当前操作系统用户同名的db用户登录。显然,尚未创建DB user
postgres
。不要将其与RDBMS或名为postgres
的系统数据库的名称混淆
您可以使用userpostgres
登录并且没有PW,这表明了两件事:
.pgpass
文件或pg_hba.conf
中的一种身份验证方法peer
,ident
或trust
将其设置为无密码访问<代码>同级最有可能createuser -h localhost -U postgres vimarshchaturvedi
vimarshchaturvedi
显然是您的操作系统用户名
psql -h localhost -U postgres
postgres=#
createuser -h localhost -U postgres vimarshchaturvedi
SELECT rolname FROM pg_roles;