我在Ruby on Rails上使用了mysql2,接下来是Kevin Skoglund的Ruby on Rails 4基础培训,以及我在早期章节中告诉我通过键入'导轨服务器“并在我的浏览器上打开”localhost:3000“。ActiveRecord :: ConnectionNotE建立了Ruby on Rails
问题是这样的: Connection not Established
所以我不能访问我的项目,不能与教程继续前进。
另外,我注意到我和教程的终端有些不同。在我的终端中,在启动WEBrick之前,它会显示: /home/jmmaglinao16/.rvm/gems/ruby-2.3.0/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282:警告:圆形参数参考 - 现在
我不确定它是否与问题有任何关联,但这就是我目前为止的情况。请帮助我们。谢谢。
的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:
# 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
请张贴你的宝石文件和你的'appname/config/database.yml'文件。 – MarsAtomic
这不是错误的原因,但是您使用的ruby版本与您正在使用的rails版本不兼容。 –
你开始使用mysql吗? – uzaif