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