PostgreSQL error 'Could not connect to server: No such file or directory'

前端 未结 22 1945
梦谈多话
梦谈多话 2020-11-29 17:20

Like some others I am getting this error when I run rake db:migrate in my project or even try most database tasks for my Ruby on Rails 3.2 applications.

22条回答
  •  情书的邮戳
    2020-11-29 17:54

    If you're on MacOS and using homebrew I found this answer extremely helpful:

    https://stackoverflow.com/a/27708774/4062901

    For me, my server was running but because of an upgrade I was having issues connecting (note: I use brew services). If Postgres is running, try cat /usr/local/var/postgres/server.log and see what the logs say. My error was a migration, not a connection issue.

    Also after the manual migration they propose (which does work but) I found there was no longer a table for my user. Try this command to fix that: createdb (answered via psql: FATAL: database "" does not exist)

提交回复
热议问题