所以我在Ubuntu for WSL上使用VS代码,并从GitHub派生了一个rails应用程序,当我试图运行rails db:set up时,它给了我这个错误:
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时,我得到了这样的结果:
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)这是否意味着问题出在我的服务器没有运行?我应该怎么做才能运行服务器或创建数据库?
发布于 2020-04-24 06:44:12
这意味着您的服务器已安装但未运行。试一试
service postgresql start 来启动服务器。
要检查实例是否正在运行,请尝试运行
psql -U postgres -d postgres除非您修改了HBA配置,否则这应该会将您连接到角色postgres中的本地postgres数据库(默认管理数据库)。
https://stackoverflow.com/questions/61393185
复制相似问题