質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

Q&A

1回答

2743閲覧

Specified 'mysql2' for database adapterというエラーです......

zeben

総合スコア67

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

0グッド

0クリップ

投稿2015/10/25 03:18

Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

というエラーが rails sした時にでてきてしまったのですがどうすれば良いのでしょうか?
mysql2はもう既にgemにいれており、bundle install もしたのですがこのエラーがでてきてしまいます!

source 'https://rubygems.org'

Bundle edge Rails instead: gem 'rails', github: 'rails/rails'

gem 'rails', '4.2.4'

Use mysql as the database for Active Record

gem 'mysql2', '0.4.1'

Use SCSS for stylesheets

gem 'sass-rails', '~> 5.0.4'

Use Uglifier as compressor for JavaScript assets

gem 'uglifier', '>= 1.3.0'

Use CoffeeScript for .coffee assets and views

gem 'coffee-rails', '~> 4.1.0'

See https://github.com/rails/execjs#readme 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: https://github.com/rails/turbolinks

gem 'turbolinks'

Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

gem 'jbuilder', '~> 2.0'

bundle exec rake doc:rails generates the API under doc/api.

gem 'sdoc', '~> 0.4.0', group: :doc

Use ActiveModel has_secure_password

gem 'bcrypt', '~> 3.1.7'

Use Unicorn as the app server

gem 'unicorn'

Use Capistrano for deployment

gem 'capistrano-rails', group: :development

group :development, :test do

Call 'byebug' anywhere in the code to stop execution and get a debugger console

gem 'byebug'
end

group :development do

Access an IRB console on exception pages or by using <%= console %> in views

gem 'web-console', '~> 2.0'

Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring

gem 'spring'
end

宜しくお願い申し上げます!

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

状況について確認したいことがあります。
$ gem list
の結果に mysql2 が含まれていますか?

$ rake db:create や $ rake db:migrate は成功してますか?

なども参照するとよいです。

投稿2015/10/25 03:27

編集2015/10/25 03:31
katoy

総合スコア22324

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

zeben

2015/10/25 03:29

含まれております! n$ gem list *** LOCAL GEMS *** actionmailer (4.2.4) actionpack (4.2.4) actionview (4.2.4) activejob (4.2.4) activemodel (4.2.4) activerecord (4.2.4) activesupport (4.2.4) arel (6.0.3) bigdecimal (1.2.6) binding_of_caller (0.7.2) builder (3.2.2) bundler (1.10.6) byebug (6.0.2) coffee-rails (4.1.0) coffee-script (2.4.1) coffee-script-source (1.9.1.1) debug_inspector (0.0.2) erubis (2.7.0) execjs (2.6.0) globalid (0.3.6) i18n (0.7.0) io-console (0.4.3) jbuilder (2.3.2) jquery-rails (4.0.5) json (1.8.3, 1.8.1) loofah (2.0.3) mail (2.6.3) mime-types (2.6.2) mini_portile (0.6.2) minitest (5.8.1, 5.4.3) multi_json (1.11.2) mysql2 (0.4.1, 0.3.18) nokogiri (1.6.6.2) power_assert (0.2.2) psych (2.0.8) rack (1.6.4) rack-test (0.6.3) rails (4.2.4) rails-deprecated_sanitizer (1.0.3) rails-dom-testing (1.0.7) rails-html-sanitizer (1.0.2) railties (4.2.4) rake (10.4.2) rdoc (4.2.0) rubygems-update (2.4.8) sass (3.4.19) sass-rails (5.0.4) sdoc (0.4.1) spring (1.4.0) sprockets (3.4.0) sprockets-rails (2.3.3) test-unit (3.0.8) thor (0.19.1) thread_safe (0.3.5) tilt (2.0.1) turbolinks (2.5.3) tzinfo (1.2.2) uglifier (2.7.2) web-console (2.2.1)
zeben

2015/10/25 03:44

rake db →$ rake db:migrate rake aborted! Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). migrateでも上記内容がでてしまいます Gem::LoadError: can't activate mysql2 (~> 0.3.13), already activated mysql2-0.4.1. Make sure all dependencies are added to Gemfile. Tasks: TOP => db:migrate => db:load_config (See full trace by running task with --trace)
zeben

2015/10/25 06:03

そうなんですか!  いま $ mysql -u root -p をやってみたんですけどソケットエラーがでてしまいました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問