簡體   English   中英

使用PostreSQL App時重新創建Rails數據庫

[英]Recreating a Rails database when using PostreSQL App

我真的是PostrgreSQL的新手,但是遇到了一個我真的不知道如何解決的問題。

我目前正在將PostreSQL 10應用程序用於OSX。 我正在嘗試使用rails db:drop db:create db:migrate重新創建Rails應用數據庫。 我收到以下錯誤:

PG::ObjectInUse: ERROR:  database "app_development" is being accessed by other users

另一個會話是Postgres應用程序,它保持連接打開:如果我運行ps -ef | grep postgres 我得到了ps -ef | grep postgres

502 38332     1   0  2:57PM ??         0:00.15 /Applications/Postgres.app/Contents/Versions/10/bin/postgres -D /Users/user/Library/Application Support/Postgres/var-10 -p 5432
502 38334 38332   0  2:57PM ??         0:00.01 postgres: checkpointer process       
502 38335 38332   0  2:57PM ??         0:00.07 postgres: writer process       
502 38336 38332   0  2:57PM ??         0:00.02 postgres: wal writer process       
502 38337 38332   0  2:57PM ??         0:00.04 postgres: autovacuum launcher process       
502 38338 38332   0  2:57PM ??         0:00.17 postgres: stats collector process       
502 38339 38332   0  2:57PM ??         0:00.01 postgres: bgworker: logical replication launcher       
502 38342 38332   0  2:57PM ??         0:00.21 postgres: user app_development [local] idle    
502 38661 38432   0  3:06PM ttys004    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn postgres

我不能只是停止Postgres應用程序,然后運行rails db:drop命令,因為這樣我會收到以下錯誤:

PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

我實際上如何重新創建數據庫? 提前致謝

嘗試重新啟動brew services restart postgresql

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM