[英]Postgresql error after installation
I already have a rails project then i installed Postgresql
and pgadmin III , I need to use posgresql in development instead of sqlite
and production to use heroku
, I followed the answer number two in this question Change from SQLite to PostgreSQL in a fresh Rails project because i just installed Postgresql
using synaptic center without making anything else , when i try to create a user i got an error: 我已经有一个Rails项目,然后安装了Postgresql
和pgadmin III,我需要在开发中使用posgresql而不是sqlite
和production来使用heroku
,所以我遵循了这个问题的答案2, 在一个新的Rails项目中从SQLite更改为PostgreSQL,因为我刚刚使用突触中心安装了Postgresql
而未做任何其他事情,当我尝试创建用户时出现错误:
createuser dexter
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y
createuser: could not connect to database postgres: FATAL: role "dexter" does not exist
use: 采用:
$ sudo -u postgres createuser
To answer your question, from the postgresql documentation : 要回答您的问题,请从PostgreSQL文档 :
"If you wish to create a new superuser, you must connect as a superuser, not merely with CREATEROLE privilege. Being a superuser implies the ability to bypass all access permission checks within the database, so superuserdom should not be granted lightly." “如果您想创建一个新的超级用户,则必须以超级用户身份连接,而不仅仅是具有CREATEROLE特权。成为超级用户意味着可以绕过数据库中所有访问权限检查的能力,因此,不应轻易授予超级用户权限。”
Given that the account you are creating is simply for granting your Rails application access, while the ability to create databases makes sense, superuser privileges is not a good idea. 鉴于您要创建的帐户仅用于授予Rails应用程序访问权限,而创建数据库的功能很有意义,因此,超级用户特权不是一个好主意。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.