Ruby on rails rails应用程序使用postgresql显示PG::错误

Ruby on rails rails应用程序使用postgresql显示PG::错误,ruby-on-rails,postgresql,Ruby On Rails,Postgresql,我刚刚使用启动了一个新的rails应用程序 rails new myapp --database=postgresql 然后生成一些静态页面: rails g controller StaticPages home about 当我启动服务器并访问localhost:3000/static_pages/home时,PG::Error显示: PG::Error could not connect to server: Connection refused (0x0000274D/10061)

我刚刚使用启动了一个新的rails应用程序

rails new myapp --database=postgresql
然后生成一些静态页面:

rails g controller StaticPages home about
当我启动服务器并访问localhost:3000/static_pages/home时,PG::Error显示:

PG::Error

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?
我没有改变其他任何事情


你知道如何让postgresql工作吗?

看来你的postgres服务器没有运行。你启动了吗?如果检查系统进程,是否看到postgres守护进程正在运行


如果您尝试使用rails+postgres,我建议您签出

是的,我没有看到它运行。你知道怎么开始吗?谢谢你的视频顺便说一下,伟大的资源。但我现在使用的是windows。如何启动取决于您的安装方式,但您可以通过查找windows服务器来启动。您的PostgreSQL服务器似乎已关闭或正在侦听其他端口。