简体   繁体   English

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

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

I'm running into the following error after uninstalling and installing several times I just can't seem to get postgresql working.卸载和安装几次后,我遇到了以下错误,我似乎无法让 postgresql 工作。 I am trying to setup the coding environment for ruby on rails 6 on windows 10. I have followed the following articles and have made it all the way to creating a user where i get the following errors.我正在尝试在 windows 10 上的导轨 6 上为 ruby 设置编码环境。我已按照以下文章进行操作,并一直致力于创建一个我得到以下错误的用户。

links to how i got here指向我如何到达这里的链接

https://github.com/serivas/wsl2_rails_setup https://github.com/serivas/wsl2_rails_setup

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

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

Error I'm getting when i type我输入时遇到的错误

sudo -u postgres createuser abc -s

Error Message;错误信息;

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"?

Thanks in advance!提前致谢!

Here's how I solved my problem for anyone that might be having similar issues.这是我为可能遇到类似问题的任何人解决问题的方法。

If your having trouble logging into Postgres make sure that you create a user in Postgres that allows the user to be able to CREATEDB.如果您在登录 Postgres 时遇到问题,请确保您在 Postgres 中创建一个允许该用户能够 CREATEDB 的用户。 So if your user is JohnDoe make sure that you give permission for JohnDoe to create database.因此,如果您的用户是 JohnDoe,请确保您授予 JohnDoe 创建数据库的权限。

Links to help you out with granting permission.帮助您授予权限的链接。

Make sure that you are starting your postgresql server.确保您正在启动 postgresql 服务器。

sudo service postgresql start

And to Stop并停止

sudo service postgresql stop

After User has rights to create the database, then you can go ahead and type in用户有权创建数据库后,您可以提前 go 并输入

rake db:create

暂无
暂无

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

相关问题 PostgreSQL无法连接错误。 - postgresql could not connect error. Postgresql 版本 13 psql:错误:无法连接到服务器:无法连接到服务器:没有这样的文件或目录 - Postgresql version 13 psql: error: could not connect to server: could not connect to server: No such file or directory PostgreSQL无法连接:处理请求时发生意外错误:无法连接到服务器:没有此类文件或目录 - PostgreSQL could not connect to: Unexpected error while processing request: could not connect to server: No such file or directory Cloud9中的postgresql错误“无法连接到服务器:连接被拒绝” - postgresql error in Cloud9 “could not connect to server: Connection refused” heroku ActionView :: Template :: Error(无法连接到服务器:没有这样的文件或目录 - heroku ActionView::Template::Error (could not connect to server: No such file or directory PostgreSQL:无法连接到服务器:连接超时 - PostgreSQL: could not connect to server: Connection timed out Postgresql 适配器 (pg):无法连接到服务器 - Postgresql adapter (pg): could not connect to server Postgres 服务器错误 -> PGError:无法连接到服务器 - Postgres Server error -> PGError: could not connect to server Postgres 无法连接到服务器 - Postgres could not connect to server Ruby on Rails和Postgresql-服务器正在运行,但我收到一个无法连接服务器的错误 - Ruby on Rails and Postgresql - Server is running, but I'm obtaining a could not connect to server error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM