0
我正在设置一个基本的RoR应用程序。我所有的数据库都是MySQL和本地数据库,包括了yml文件。我试图访问一个基本的视图,但仍然得到ActiveRecord :: ConnectionNotEstablished错误。我究竟做错了什么?Ruby on Rails ActiveRecord :: ConnectionNotEstablished
# database.yml
development:
adapter: mysql2
encoding: utf8
database: *****_dev
username: ****
password: *****
host: 127.0.0.1
port: 3306
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
database: *****_test
username: ****
password: *****
host: 127.0.0.1
port: 3306
production:
adapter: mysql2
encoding: utf8
database: *****_prod
username: ****
password: *****
host: 127.0.0.1
port: 3306
MySQL2在宝石文件:
gem 'mysql2', '~>0.3.10'
所以,当转到输入:http://localhost:3000/controller/view
我得到:ActiveRecord的:: ConnectionNotEstablished
我还能包括将是有益的?
在此先感谢。
如果用本地主机替换127.0.0.1运作的?还有哪个版本的Rails? 3.2.6? – ScottJShea 2012-07-08 09:39:10
如果我用localhost替换127.0.0.1,如果我尝试运行rake db:migrate,则会出现套接字错误。用127.0.0.1 rake db:migrate运行没有错误。另外,我在rails 3.2.2上。谢谢。 – analyticsPierce 2012-07-08 17:12:00
你安装了apache和mysql吗? http:// localhost /之后的结果是什么? – chaitanya 2012-07-09 05:25:18