首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Ubuntu for WSL上配置postgresql to rails时遇到问题

在Ubuntu for WSL上配置postgresql to rails时遇到问题
EN

Stack Overflow用户
提问于 2020-04-24 01:19:17
回答 1查看 923关注 0票数 0

所以我在Ubuntu for WSL上使用VS代码,并从GitHub派生了一个rails应用程序,当我试图运行rails db:set up时,它给了我这个错误:

代码语言:javascript
复制
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"?
Couldn't create 'development_database' database. Please check your configuration.
rails aborted!
ActiveRecord::NoDatabaseError: 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"?

...traces...

Caused by:
PG::ConnectionBad: 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"?

当我尝试运行service postgresql status时,我得到了10/main (port 5432): down

当我尝试dpkg -l | grep postgres时,我得到了这样的结果:

代码语言:javascript
复制
ii  postgresql                     10+190ubuntu0.1                    all          object-relational SQL database (supported version)
ii  postgresql-10                  10.10-0ubuntu0.18.04.1             amd64        object-relational SQL database, version 10 server
ii  postgresql-client              10+190ubuntu0.1                    all          front-end programs for PostgreSQL (supported version)
ii  postgresql-client-10           10.10-0ubuntu0.18.04.1             amd64        front-end programs for PostgreSQL 10
ii  postgresql-client-common       190ubuntu0.1                       all          manager for multiple PostgreSQL client versions
ii  postgresql-common              190ubuntu0.1                       all          PostgreSQL database-cluster manager
ii  postgresql-contrib             10+190ubuntu0.1                    all          additional facilities for PostgreSQL (supported version)

这是否意味着问题出在我的服务器没有运行?我应该怎么做才能运行服务器或创建数据库?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-24 06:44:12

这意味着您的服务器已安装但未运行。试一试

代码语言:javascript
复制
service postgresql start 

来启动服务器。

要检查实例是否正在运行,请尝试运行

代码语言:javascript
复制
psql -U postgres -d postgres

除非您修改了HBA配置,否则这应该会将您连接到角色postgres中的本地postgres数据库(默认管理数据库)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61393185

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档