[英]ActiveRecord::ConnectionNotEstablished Ruby on Rails
I'm using mysql2 on Ruby on Rails, following Ruby on Rails 4 Essential Training by Kevin Skoglund, and I'm on the early chapters where it tells me to access the project by typing 'rails server' and opening 'localhost:3000' on my browser. 我在Kevin on Skoglund的Ruby on Rails 4基本培训之后,在Ruby on Rails上使用mysql2,并且在早期的章节中,它告诉我通过键入“ rails server”并打开“ localhost:3000”来访问项目。在我的浏览器上。
Problem is this: Connection not Established 问题是这样的: 未建立连接
So I cannot access my project, and can't move on with the tutorials. 因此,我无法访问我的项目,也无法继续学习教程。
Also, I noticed something different between my and the tutorial's terminal. 另外,我注意到本人和本教程的终端之间有些不同。 In my terminal, before booting WEBrick, it shows this: /home/jmmaglinao16/.rvm/gems/ruby-2.3.0/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
在我的终端中,在启动WEBrick之前,它显示以下内容:/home/jmmaglinao16/.rvm/gems/ruby-2.3.0/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282:警告:循环参数参考-现在
I'm not sure if it has any connection to the problem but that's what I have so far. 我不确定它是否与问题有关,但这就是我到目前为止的问题。 Please help me guys.
请帮助我。 Thank you.
谢谢。
Gemfile: 宝石文件:
source 'rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
#gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
#gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
#gem 'coffee-rails', '~> 4.0.0'
# See for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
#gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more:
#gem 'turbolinks'
# Build JSON APIs with ease. Read more:
#gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
Database.yml: Database.yml:
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
#
development:
adapter: mysql2
encoding: utf8
database: #simple_cms_development
pool: 5
username: root
password: mypass
socket: /var/run/mysqld/mysqld.sock
# 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: simple_cms_test
pool: 5
username: root
password: mypass
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql2
encoding: utf8
database: simple_cms_production
pool: 5
username: root
password: mypass
socket: /var/run/mysqld/mysqld.sock
Try putting the '#' in the beginning of the line like here: 尝试将'#'放在行的开头,如下所示:
#database: simple_cms_development #数据库:simple_cms_development
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.