1

我最近重新启动了我的计算机,在尝试使用本地启动我的数据库后,rails s我得到了以下信息:

/Users/example_name/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in 

`initialize': could not connect to server: 

No such file or directory (PGError)

然后我尝试通过编写手动启动数据库:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

然后它说server starting所以我重新输入rails s然后我收到错误:

FATAL: role example_name doesn't exist

这是我以前从未遇到过的一个奇怪错误,所以我尝试再次创建角色,然后再次运行 rails s 后得到:

FATAL:  database "example_db" does not exist (PGError)

我认为我没有做任何事情来删除数据库,所以我不确定到底发生了什么。

我做到了rake db:create:allbundle exec rake db:migrate现在它可以工作了,但是数据库是空的!这怎么发生的?如果我部署它,这不会清空我的生产数据库吗?

4

0 回答 0