简体   繁体   English

psql:致命:“用户名”角色不可用

[英]psql: FATAL: "username" role not available

I am trying psql and getting an error.我正在尝试 psql 并收到错误消息。

$ psql
psql: FATAL: "myilmaz" role not available

Then I try然后我尝试

$ createdb python_getting_started
createdb: Unable to connect to template1 database: FATAL: "myilmaz" does not have access to the system

I run export DATABASE_URL=postgres://$(whoami) as indicated here and then started getting this error.我按照此处所示运行export DATABASE_URL=postgres://$(whoami) ,然后开始收到此错误。 I don't know if there was an error before that.不知道之前有没有报错。

Note: I'm using Pardus 17.3, and it based Debian 9. 'myilmaz' is my username.注意:我使用的是 Pardus 17.3,它基于 Debian 9。“myilmaz”是我的用户名。

Edit: I tried adding my user to template1 in postgres user.编辑:我尝试将我的用户添加到 postgres 用户中的 template1。

These error messages do not appear in PostgreSQL; 这些错误消息不会出现在PostgreSQL中。 did you freely translate them from another language? 您是否将其自由地从另一种语言翻译?

Anyway, your problem is likely that psql and createdb assume a database user name identical to your current operating system user name, which is myilmaz . 无论如何,您的问题很可能是psqlcreatedb假定数据库用户名与您当前的操作系统用户名myilmaz

You can specify a database user name with the -U option. 您可以使用-U选项指定数据库用户名。

But it is probably better to login as operating system user postgres and then run the commands, this is typically how PostgreSQL installations are set up. 但是最好以操作系统用户postgres身份登录,然后运行命令,这通常是设置PostgreSQL安装的方式。

我遇到了同样的错误,我通过转到 PostgreSQL 并手动添加数据库名称然后 npm start 解决了同样的错误,现在一切正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM