所以在使用post Postgres rails doesn't recognize user之后的postgres问题之后,我卸载了postgres并决定尝试使用mysql for我的rails应用程序。我成功安装了mysql,并按如下方式设置了我的database.yml:
development:
adapter: mysql2
database: db_development
user: root
pool: 5
password: ##
timeout: 5000
test:
adapter: mysql2
database: db_test
user: root
pool: 5
password: #
timeout: 5000
production:
adapter: mysql2
database: db_production
username: root
pool: 5
password: ##
timeout: 5000
我也做了rake db:create:all和rake db:migrate。但是,我得到了“我们很抱歉,但出了点问题”,当我查看日志时,我得到PG(postgres错误),如下所示:
PG::Error (FATAL: role "ubuntu" does not exist
):
activerecord (3.2.13) lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize'
稍后,它引用了之前在database.yml中提到的PG数据库,不再存在:
PG::Error (FATAL: database "db/production" does not exist
):
activerecord (3.2.13) lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize'
我不知道发生了什么。 FWIW我正在使用ruby 2.0,rails 3.2.13,nginx和phusion passenger