Ruby on rails 使用PostreSQL应用程序时重新创建Rails数据库

Ruby on rails 使用PostreSQL应用程序时重新创建Rails数据库,ruby-on-rails,postgresql,postgresapp,Ruby On Rails,Postgresql,Postgresapp,我对PostrgreSQL非常陌生,遇到了一个我真的不知道如何解决的问题 我目前正在使用OSX的PostResql10应用程序;我正在尝试使用Rails-db:drop-db:create-db:migrate重新创建一个Rails应用程序数据库。我得到以下错误: PG::ObjectInUse: ERROR: database "app_development" is being accessed by other users PG::ConnectionBad: could not co

我对PostrgreSQL非常陌生,遇到了一个我真的不知道如何解决的问题

我目前正在使用OSX的PostResql10应用程序;我正在尝试使用
Rails-db:drop-db:create-db:migrate
重新创建一个Rails应用程序数据库。我得到以下错误:

PG::ObjectInUse: ERROR:  database "app_development" is being accessed by other users
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"?
另一个会话是保持连接打开的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::ObjectInUse: ERROR:  database "app_development" is being accessed by other users
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服务重新启动postgresql

尝试sudo服务postgresql重新启动@MayurShah抱歉,忘记指定我在OSX上。然后尝试brew服务重新启动postgresql@MayurShah工作正常,谢谢!