Just Another ActiveRecord::ConnectionNotEstablished Question

I am trying to follow RESTful Rails Development from O'Reilly by Silvia

I have created an app (wikicat), database (MySQL), models (category and
link), controllers (CategoryController show) and routes. I have followed
everything that the book said (taking in to consideration the published
errata) and I am going round and round in circles trying to fix an
ActiveRecord::ConnectionNotEstablished error.

I am running on Linux Mint 17.2 with:

Rails version 4.1.4
mysql version 14.14 Distribution 5.5.46

I have started mysql server. My Gemfile has been bundled and is shown

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
gem 'rails-api'

# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'

#Serialiser for JSON
gem 'active_model_serializers'
group :doc do
  #bundle exec rake doc:rails generates the API under doc/api
  gem 'sdoc', '~>0.4.0'
group :development do
  #Spring speeds up development by keeping your application
  #running in the background. Read more:
  gem 'spring'

There isn't an application trace, but there is a framework trace which I
have pasted below:

activerecord (4.1.4)
activerecord (4.1.4) lib/active_record/connection_handling.rb:113:in
activerecord (4.1.4) lib/active_record/connection_handling.rb:87:in
activerecord (4.1.4) lib/active_record/migration.rb:388:in
activerecord (4.1.4) lib/active_record/migration.rb:377:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:29:in
`block in call'
activesupport (4.1.4) lib/active_support/callbacks.rb:82:in
actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:27:in
actionpack (4.1.4) lib/action_dispatch/middleware/reloader.rb:73:in
actionpack (4.1.4) lib/action_dispatch/middleware/remote_ip.rb:76:in
actionpack (4.1.4)
lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.4)
lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in `block
in tagged'
activesupport (4.1.4) lib/active_support/tagged_logging.rb:26:in
activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in
railties (4.1.4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/request_id.rb:21:in
rack (1.5.5) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.4)
lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.5) lib/rack/lock.rb:17:in `call'
actionpack (4.1.4) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.1.4) lib/rails/engine.rb:514:in `call'
railties (4.1.4) lib/rails/application.rb:144:in `call'
rack (1.5.5) lib/rack/lock.rb:17:in `call'
rack (1.5.5) lib/rack/content_length.rb:14:in `call'
rack (1.5.5) lib/rack/handler/webrick.rb:60:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Is there anything in there telling me why I can't get a connection?
Thank you for your patience with my newbie query.

  1. Did you install mysql properly?
    a) Try to connect to mysql server from a command line, and run some simple queries against your database.

b) Create a simple (pure) Ruby application and try to connect to your database from this application.

If it works fine, then your problem is Rails based.

  1. Have a look at database.yml file.