繁体   English   中英

PostgreSQL 错误:无法连接到数据库模板1:无法连接到服务器:

[英]PostgreSQL error: could not connect to database template1: could not connect to server:

卸载和安装几次后,我遇到了以下错误,我似乎无法让 postgresql 工作。 我正在尝试在 windows 10 上的导轨 6 上为 ruby 设置编码环境。我已按照以下文章进行操作,并一直致力于创建一个我得到以下错误的用户。

指向我如何到达这里的链接

https://github.com/serivas/wsl2_rails_setup

https://gorails.com/setup/windows/10#ruby-rbenv

https://www.postgresql.org/download/linux/ubuntu/

我输入时遇到的错误

sudo -u postgres createuser abc -s

错误信息;

createuser: error: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

提前致谢!

这是我为可能遇到类似问题的任何人解决问题的方法。

如果您在登录 Postgres 时遇到问题,请确保您在 Postgres 中创建一个允许该用户能够 CREATEDB 的用户。 因此,如果您的用户是 JohnDoe,请确保您授予 JohnDoe 创建数据库的权限。

帮助您授予权限的链接。

确保您正在启动 postgresql 服务器。

sudo service postgresql start

并停止

sudo service postgresql stop

用户有权创建数据库后,您可以提前 go 并输入

rake db:create

暂无
暂无

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

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