使用 PostgreSQL App 时重新创建 Rails 数据库
Recreating a Rails database when using PostreSQL App
我是 PostrgreSQL 的新手,我 运行 遇到了一个我真的不知道如何解决的问题。
我目前正在为 OSX 使用 PostreSQL 10 应用程序;我正在尝试使用 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
,我得到
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
我是 PostrgreSQL 的新手,我 运行 遇到了一个我真的不知道如何解决的问题。
我目前正在为 OSX 使用 PostreSQL 10 应用程序;我正在尝试使用 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
,我得到
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