mysql2 Gem error on rails - mysql

I want to continue programming a rail app but the following error occurs when I try to start the server rails s.
My rail installation seems to work fine when I have a brand new directory (it uses sqlite3 there). I also probably have everything installed, xcode, homebrew, RVM...
Operating system: OS X, 1.8.2
Any ideas to solve this error?
/Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error)
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /Users/myself/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /Users/myself/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/model_schema.rb:308:in `clear_cache!'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie>'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:418:in `_run__4072264347074867870__prepare__1617522906049658136__callbacks'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:405:in `__run_callback'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/myself/events/config/environment.rb:5:in `<top (required)>'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from /Users/myself/events/config.ru:4:in `block in <main>'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/myself/events/config.ru:1:in `new'
from /Users/myself/events/config.ru:1:in `<main>'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/server.rb:46:in `app'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/server.rb:70:in `start'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
from /Users/myself/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

The location is different on osx, look for /private/var/mysql/mysql.sock
Your options are to change the socket value in database.yml or create a symbolic link at /tmp/myslq.sock
I prefer the later since it's a common issue.

Related

Issue doing jekyll serve

bundle exec jekyll build
gets stuck after auto-regeneration
jekyll serve --force_polling gives me the error uninitialized constant Bundler::Plugin::API::Source (NameError) with the following:
/Library/Ruby/Gems/2.0.0/gems/bundler-1.13.0/lib/bundler/rubygems_ext.rb:35:in `full_gem_path': uninitialized constant Bundler::Plugin::API::Source (NameError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:1391:in `contains_requirable_file?'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:68:in `block in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:823:in `block in each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:822:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:822:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:67:in `find'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:67:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.13.0/lib/bundler/plugin/api/source.rb:2:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.13.0/lib/bundler/rubygems_ext.rb:35:in `full_gem_path'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:1391:in `contains_requirable_file?'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:68:in `block in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:823:in `block in each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:822:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:822:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:67:in `find'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:67:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.13.0/lib/bundler.rb:11:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /Library/Ruby/Gems/2.0.0/gems/jekyll-3.2.1/lib/jekyll/plugin_manager.rb:34:in `require_from_bundler'
from /Library/Ruby/Gems/2.0.0/gems/jekyll-3.2.1/exe/jekyll:9:in `<top (required)>'
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'
How should I go about it?
I solved this problem by changing owner of this directory to my local user.
chown -R myuser:mygroup /Library/Ruby/Gems

rails server not starting on rails 3.1.2

I am using rails 3.2.1 with ruby 1.9.3 on ubuntu 13.10 with rbenv I hace everything good but when I try to start the server it gives an error anybody who know anything related to this please help. In a great need.
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- uuid (LoadError)
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/ahmed/Insoshi-Rails-3/config/initializers/custom_requires.rb:17:in `<top (required)>'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/notifications.rb:166:in `instrument'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/engine.rb:651:in `load_config_initializer'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/engine.rb:615:in `each'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/engine.rb:615:in `block in <class:Engine>'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:209:in `block in each_strongly_connected_component_from'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `each'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:203:in `each_strongly_connected_component_from'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:180:in `each'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/railtie.rb:194:in `public_send'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/railtie.rb:194:in `method_missing'
from /home/ahmed/Insoshi-Rails-3/config/environment.rb:5:in `<top (required)>'
from /home/ahmed/Insoshi-Rails-3/config.ru:3:in `require'
from /home/ahmed/Insoshi-Rails-3/config.ru:3:in `block in <main>'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
from /home/ahmed/Insoshi-Rails-3/config.ru:in `new'
from /home/ahmed/Insoshi-Rails-3/config.ru:in `<main>'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands/server.rb:61:in `app'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands/server.rb:78:in `start'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/ahmed/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>
It is possible that all dependencies are not installed. If you have not used rvm to install ruby, you should try using it to install your ruby version.
rvm install 1.9.3
or
rvm reinstall 1.9.3
refer https://rvm.io/rvm/install for step by step instructions.

Rails MySQL Connection Problems

I am having an issue connecting to the mysql database using rails. I'm a newbie to rails but I have tried the guide here:
rails + MySQL on OSX: Library not loaded: libmysqlclient.18.dylib
and this still does not work. I believe I have two installations of mysql installed and this is confusing rails.
I have MAMP installed with it's own mysql and I also have the rails mysql2 gem installed. When I follow the steps from the link provided above, I think this is using the MAMP mysql install instead of the mysql2 install that I have with rails gems so it isn't recognizing it.
Is there any way I can consolidate the two mysql's into one? Or is it easier to modify rails so it can see the mysql2 gem?
Here is my error:
~/Sites/RoR3-Essentials/simple_cms ->rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://localhost:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in
`connect': Unknown database 'simple_cms_development' (Mysql2::Error)
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /Users/markmilly/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /Users/markmilly/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88:in `block in <class:Railtie>'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/markmilly/Sites/RoR3-Essentials/simple_cms/config/environment.rb:5:in `<top (required)>'
from /Users/markmilly/Sites/RoR3-Essentials/simple_cms/config.ru:3:in `require'
from /Users/markmilly/Sites/RoR3-Essentials/simple_cms/config.ru:3:in `block in <main>'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Users/markmilly/Sites/RoR3-Essentials/simple_cms/config.ru:in `new'
from /Users/markmilly/Sites/RoR3-Essentials/simple_cms/config.ru:in `<main>'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/markmilly/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
#markmilly Answer to your last comment:
'rake db:create' creates the db that you specified in your config/database.yml file.
It will create the db for the current RAILS_ENV you're on. If the environment is not specified it will default to the development and test db's.
I see this answer is a bit late, but it might help someone else.

Rails server error when copying LIMMYSQL.dll from MySql to Ruby bin folder

I copy LIMMYSQL.dll from MySql and put it in Ruby bin folder and then start rails server and I am getting below error. Please help me
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require': 193: %1 is not a valid Win32
application. - c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
from d:/merlin_demo_app/demo_app/config/application.rb:7:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:53:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:53:in `block in <top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have solved this, eventually!
I re-installed Ruby and Rails under RVM. I'm using Ruby version 1.9.2-p136.
After re-installing under rvm, this error was still present.
In the end the magic command that solved it was:

Ruby on rails : rake aborted bad file descriptor

I have searched around, but I have not been able to find a answer that works.
I am completely new at this, so when you answer, then explain like I am a child... Or explain like I am a piece of broccoli. If you want me to install something, tell me what to write.
Well, I am trying to follow this http://guides.fatfreecrm.com/Setup-Microsoft-Windows.html and I have come to a spot where I am supposed to write
rake db:create RAILS_ENV=production
and all I got was this: (I have done the "gem install mysql2" , I have installed rake as in the tutorial and have not seen any issues)
C:\RailsInstaller\fat_free_crm>rake db:create RAILS_ENV=production --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create rake aborted! Bad file descriptor
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:312:in `query'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:312:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:629:in
`configure_connecti on'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:169:in
`initialize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:16:in
`mysql2_connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:309:in
`new_connection '
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:319:in
`checkout_new_c onnection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:241:in
`block (2 level s) in checkout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:236:in
`loop'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:236:in
`block in check out'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in
`mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:233:in
`checkout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:96:in `block
in connec tion'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in
`mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:95:in
`connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:404:in
`retrieve_conne ction'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_specification.rb:170:in
`retri eve_connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_specification.rb:144:in
`conne ction'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:83:in `rescue in create_database'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:51:in `create_database'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:40:in `block (3 levels) in <top
(required)>'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:40:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:40:in `block (2 levels) in <top
(required)>'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:205:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:205:in `block in execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:200:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:200:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:158:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in
`mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:151:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:144:in `invoke'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:116:in `invoke_task'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:88:in `top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:66:in `block in run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:63:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in
`<top (required)>' C:/RailsInstaller/Ruby1.9.3/bin/rake:23:in `load'
C:/RailsInstaller/Ruby1.9.3/bin/rake:23:in `<main>' Tasks: TOP =>
db:create
I had same issues and fixed it after spending two hours. May be it will help you too.
So here are the steps, which lead me to fix the issue
I am assuming you are running 32 bit mysql because the problem for 64bit+32bit mysql can be something else
Make sure mysql.dll is compatiable with installed gem (I have mysql2)
To avoid issue down load it from http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
Copy mysql.dll to your ruby/bin
Summary: For me it was the problem of incompatibility between rails mysql2 gem and the one, which was installed on my machine