我看到的大部分与 sudo service postgresql restart
有关。
我尝试了这个命令,但没有效果。
其他答案是从 /usr/local/var/psql
中删除一个文件。
问题在于我在 /local/
中没有 /var/
文件夹。
完整转储:
[17:51:55] shell-ratings-backend (master)
// ♥ sudo service postgresql restart
* Restarting PostgreSQL 14 database server [ OK ]
[17:52:29] shell-ratings-backend (master)
// ♥ rails db:migrate
rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/rails:5:in `<top (required)>'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:10:in `require'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:10:in `block in <top (required)>'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:7:in `tap'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:7:in `<top (required)>'
Caused by:
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/rails:5:in `<top (required)>'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:10:in `require'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:10:in `block in <top (required)>'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:7:in `tap'
/mnt/c/Users/Alex/dev/shell-ratings-backend/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)