[英]Rails db:create using PostgreSQL return PG::ConnectionBad: could not connect to server: Connection refused
I was following the tutorial to develop using react and rails from the DigitalOcean Tutorial .我正在按照教程使用DigitalOcean 教程中的react 和 rails 进行开发。
I have done我已经做好了
rails new rails_react_recipe -d=postgresql -T --webpack=react --skip-coffee
It created the directory with all the necessary tools - ruby and rails.它创建了包含所有必要工具的目录 - ruby 和 rails。 Then the next step is to create the database
然后下一步就是创建数据库
rails db:create
but it returned me the error below但它返回了我下面的错误
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Couldn't create 'rails_react_recipe_development' database. Please check your configuration.
rails aborted!
PG::ConnectionBad: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)
I have installed postgresql 12 for windows from https://www.postgresql.org/download/我已经从https://www.postgresql.org/download/为 windows 安装了 postgresql 12
I couldn't find any solution online.我在网上找不到任何解决方案。 Help will be really appreciated.
帮助将不胜感激。 Thanks!
谢谢!
You need to start the Postgres server for it to start accepting connections.您需要启动 Postgres 服务器才能开始接受连接。 Currently, you've probably downloaded Postgres, but not started it.
目前,您可能已经下载了 Postgres,但尚未启动它。
You could follow instructions here to learn how to start it on Windows: https://tableplus.com/blog/2018/10/how-to-start-stop-restart-postgresql-server.html您可以按照此处的说明了解如何在 Windows 上启动它: https : //tableplus.com/blog/2018/10/how-to-start-stop-restart-postgresql-server.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.