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

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

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

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

Q&A

0回答

292閲覧

Ruby in Rails 4でActiveRecord::ConnectionNotEstablishedが発生する。

speed_star777

総合スコア57

Ruby on Rails 4

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

0グッド

0クリップ

投稿2017/07/09 07:28

Ruby in Rails 4をcentosに入れて、bundle exec rails s -b 0.0.0.0で起動させて、
ブラウザからアクセスしたところ「ActiveRecord::ConnectionNotEstablished」とエラーが表示されてしまいました。
イメージ説明

mysqlでの接続を想定していまして、
centosにmysqlは入れております。データベースも作成済みです。

環境や設定ファイルは下記のようになっています。

環境

  • centos 6.7
  • msyql 5.7.18
  • ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
  • rails 4.2.9

設定ファイル

  • Gemfile
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.9' # Use sqlite3 as the database for Active Record # gem 'sqlite3' gem 'mysql2' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # 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' # gem 'therubyracer', platforms: :ruby end
  • config/database.yml

database.yml

1# SQLite version 3.x 2# gem install sqlite3 3# 4# Ensure the SQLite 3 gem is defined in your Gemfile 5# gem 'sqlite3' 6# 7default: &default 8 adapter: mysql2 9 encoding: utf8 10 database: db_name 11 pool: 5 12 username: root 13 password: 14 socket: /tmp/mysql.sock 15 16development: 17 <<: *default 18# database: db/development.sqlite3 19 20# Warning: The database defined as "test" will be erased and 21# re-generated from your development database when you run "rake". 22# Do not set this db to the same as development or production. 23test: 24 <<: *default 25# database: db/test.sqlite3 26 27production: 28 <<: *default 29# database: db/production.sqlite3 30

何か原因等わかる方がいらっしゃいましたら、
ご教授いただけますでしょうか。

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

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

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

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問