当我运行bundle exec rake db:create
:
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
任何想法如何解决这个问题?
答案 0 :(得分:0)
这可能是因为许可问题。导航到/etc/postgresql/<your version of pg>/main/
并打开pg_hba.conf。
在那里搜索一句话
local all postgres peer
并将其替换为local all all trust
。
然后在终端中运行sudo service postgresql restart
。
答案 1 :(得分:0)
试试这个:
它会起作用
您的database.yml
应如下所示:
development:
adapter: postgresql
encoding: unicode
database: <DATABASE_NAME>
pool: 5
username: <username>
password: <password>
host: localhost
port: 5432
对于其他环境也是如此