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.

2) Have a look at database.yml file.
   adapter
   database
   ....
ok?

On Sat, Dec 5, 2015 at 4:55 AM, Ben Thomas <li...@ruby-forum.com> wrote:

> I am trying to follow RESTful Rails Development from O'Reilly by Silvia
> Puglisi.
>
> 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
> below:
>
>
>
> 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'
> end
> group :development do
>   #Spring speeds up development by keeping your application
>   #running in the background. Read more:
>   #https://github.com/rails/spring
>   gem 'spring'
> end
>
>
>
> There isn't an application trace, but there is a framework trace which I
> have pasted below:
>
> activerecord (4.1.4)
> lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in
> `retrieve_connection'
> activerecord (4.1.4) lib/active_record/connection_handling.rb:113:in
> `retrieve_connection'
> activerecord (4.1.4) lib/active_record/connection_handling.rb:87:in
> `connection'
> activerecord (4.1.4) lib/active_record/migration.rb:388:in
> `check_pending!'
> 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
> `run_callbacks'
> actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:27:in
> `call'
> actionpack (4.1.4) lib/action_dispatch/middleware/reloader.rb:73:in
> `call'
> actionpack (4.1.4) lib/action_dispatch/middleware/remote_ip.rb:76:in
> `call'
> 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
> `tagged'
> activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in
> `tagged'
> 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
> `call'
> 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.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/d08c9ceaeec5c9517ecfa321ede9f8b6%40ruby-forum.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAG_K1Sb_G53T1ZQrcgHxreZZznGr%2B9eAdykDJDK_69fufer%3DiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to