Ruby on rails database.yml文件中的Postgres数据库用户名
如何在本地计算机中查找数据库的Ruby on rails database.yml文件中的Postgres数据库用户名,ruby-on-rails,database,ruby-on-rails-3,postgresql,Ruby On Rails,Database,Ruby On Rails 3,Postgresql,如何在本地计算机中查找数据库的用户名?我正在更新rails应用程序中的数据库.yml文件,但我尝试的任何方法都不起作用 尝试使用postgres(或其他选项,如mymacusername)时,我遇到以下错误: FATAL: role "postgres" does not exist createuser: could not connect to database postgres: could not connect to server: No such file or director
用户名
?我正在更新rails应用程序中的数据库.yml
文件,但我尝试的任何方法都不起作用
尝试使用postgres
(或其他选项,如mymacusername
)时,我遇到以下错误:
FATAL: role "postgres" does not exist
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
我需要创建它吗?怎么用?或者我可以使用计算机上现有的用户名吗
更新:
我正在尝试创建一个用户(这是在安装后不久,所以问题可能是它还不存在)
我运行了createuser-s-U$USER
要添加的角色名称:postgres
但是我得到了以下错误:
FATAL: role "postgres" does not exist
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
这就是问题所在-如何使其侦听正确的套接字?如果您具有root访问权限:
sudo -u postgres psql DATABASENAME
内部it类型
\l
要显示所有数据库及其用户(如果您具有root访问权限),请执行以下操作:
sudo -u postgres psql DATABASENAME
内部it类型
\l
要显示所有数据库及其用户,只需创建postgres角色。 用于创建角色名称postgres的命令: 1.sudo-u postgres psql
2.使用超级用户CREATEDB CREATEROLE登录加密密码“PASSWORD”创建角色postgres我们只需要创建postgres角色。 用于创建角色名称postgres的命令: 1.sudo-u postgres psql
2.使用超级用户CREATEDB CREATEROLE登录加密密码“PASSWORD”创建角色postgres我有管理员权限。我试过了,得到了
sudo:unknown user:postgres
试着看看谢谢,这似乎是个问题,但解决方案不在那里-我怎样才能找到那个套接字并让它听呢?我正在尝试sudo find/-name.s.PGSQL.5432-ls
,但不确定如何让postgres与它对话netstat-nlp | grep-postgre
。侦听端口应该是最后一个数字。resultnetstat:option中应该有1个以上的条目需要一个参数--p
I具有管理员访问权限。我试过了,得到了sudo:unknown user:postgres
试着看看谢谢,这似乎是个问题,但解决方案不在那里-我怎样才能找到那个套接字并让它听呢?我正在尝试sudo find/-name.s.PGSQL.5432-ls
,但不确定如何让postgres与它对话netstat-nlp | grep-postgre
。侦听端口应该是最后一个数字。结果netstat:option中应该有1个以上的条目需要一个参数--p