mysql + ruby = nightmare - mysql

Ok, I'm done.
I can't understand why I got this error with:
rake features
It cant' be I can't connect to mysql cause the:
rake db:migrate
works perfectly.
I keep having this error:
rake features --trace
(in /Users/myname/Projects/rails_app)
** Invoke features (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
rake aborted!
closed stream
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mysql.rb:1032:in `sync='
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mysql.rb:1032:in `write'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mysql.rb:1092:in `finalizer'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mysql.rb:578:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mysql.rb:578:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mysql.rb:578:in `free'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:438:in `tables'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:24:in `table_exists?'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:106:in `create_table'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:473:in `create_table'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/migration.rb:352:in `send'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/migration.rb:352:in `method_missing'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/migration.rb:328:in `say_with_time'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/migration.rb:328:in `say_with_time'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/migration.rb:348:in `method_missing'
/Users/myname/Projects/rails_app/db/schema.rb:38
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/schema.rb:43:in `instance_eval'
/Users/myname/Projects/rails_app/vendor/rails/activerecord/lib/active_record/schema.rb:43:in `define'
/Users/myname/Projects/rails_app/db/schema.rb:12
/Users/myname/Projects/rails_app/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
/Users/myname/Projects/rails_app/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/myname/Projects/rails_app/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/myname/Projects/rails_app/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/myname/Projects/rails_app/vendor/rails/railties/lib/tasks/databases.rake:259
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/myname/Projects/rails_app/vendor/rails/railties/lib/tasks/databases.rake:304
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/myname/Projects/rails_app/vendor/rails/railties/lib/tasks/databases.rake:378
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/myname/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
My machine:
Mac OS X 10.5.8
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
Rails 2.3.4
mysql (2.8.1) [rubygem]
Mysql path: /opt/local/lib/mysql5 [installed via macport]
Thank you so much!

Save your DBs and reinstall mysql. Follow http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/ Made all my problems go away.

I have to theories about your problem, but no reason to suspect either is really your cause, but they're quick checks.
You haven't properly defined the testing database in config/databases.yml
The mysql user that is attempting to build this database lacks the permission to do so.

Can you connect to the database in question with the credentials in question (all the stuff in database.yml)?
"mysql -u your_user -p" from the command line?
When you installed the mysql gem did it properly build the native extensions?
What happens when you gem install mysql --force (to re-install it)? Does it look happy?
Have you ever done this before? Is the problem as likely to be a lack of experience with rails/mysql or both? Or is this old hat and you just can't figure it out this time?
If the former, the tutorial in the pragramatic agile web development with rails is quite good (as is the rest of the book).
Hope something there helps.

Please tell the output of:
rake db:schema:load RAILS_ENV=test
to be sure that an existing database named _test is configured and working under config/database.yml

Related

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.

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

Sunspot running on windows with rails

I followed the instruction and installed the sunspot_rails gem
when I do
bundle exec rake sunspot:solr:start
it tells me
This command is not supported on i386-mingw32. Use rake sunspot:solr:run to run Solr in the foreground.
when I use that command I get
** Invoke sunspot:solr:run (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:solr:run
The syntax of the command is incorrect.
rake aborted!
You need a Java Runtime Environment to run the Solr server
C:/Ruby192/lib/ruby/gems/1.9.1/gems/sunspot_solr-1.3.0/lib/sunspot/solr/server.rb:202:in `ensure_java_installed'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/sunspot_solr-1.3.0/lib/sunspot/solr/server.rb:27:in `initialize'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/sunspot_solr-1.3.0/lib/sunspot/solr/tasks.rb:23:in `new'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/sunspot_solr-1.3.0/lib/sunspot/solr/tasks.rb:23:in `block (3 levels) in <top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
C:/Ruby192/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:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/bin/rake:19:in `load'
C:/Ruby192/lib/ruby/gems/1.9.1/bin/rake:19:in `<main>'
Tasks: TOP => sunspot:solr:run
I am running windows 7 x64.
sunspot won't run on windows?
solved..
Thought it was a java issue, but even after I installed java it won't work.
I found the answer (which apparently shouldn't be an issue with latest push of sunspot..)
the latest push fixed the issue
https://github.com/sunspot/sunspot/commit/721d3419492852533764d58f2c7f398687891a94
since bundler apparently didn't fetch me the latest, I changed it manually and it now works..

MySql2 on Rails 3.0.3 on Mac OS X

I know this has been asked many times by different other users with similar problem, but I can't seems to find one that are similar to my case:
My specs:
OS - Mac OSX 10.6 Snowleopard
SQL Server - MySQL 5.5
Rails - 3.0.3
Ruby 1.8.7
While try to run a rake db:create, I run into the following error message:
"uninitialized constant Mysql2"
Full trace is posted if you are interested:-
** 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!
uninitialized constant Mysql2
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:64:in `create_database'
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:33
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Same configuration, same problem here...
Edit: Solved! Had to add gem 'mysql2' to the Gemfile and run bundle install. Now it works fine.
Try:
sudo gem install mysql2
bundle install

How to install mysql on a new machine for an old app?

Not exactly sure how to go about this.
My app's database.yml
development:
adapter: mysql
encoding: utf8
reconnect: false
database: application-dev
pool: 5
username: root
password: angles123
socket: /tmp/mysql.sock
I was thinking that it would be wise to go ahead and mysqladmin -u root --password=angles123, and then once inside create database application-dev, but the -dev part, mysql is not happy about. But Icould create a database that said simply application.
Am I missing someting else possibly?
The reason I am bringing this up is because I get this error whenever I try to rake db:migrate, or script/server
rake db:test:prepare
(in /Users/macuser/Sites/hq_channel)
rake aborted!
uninitialized constant Geocode
So I assumed I set up the database wrong because I clearly have that gem installed.
Here is the full stacktrace :
rake aborted!
uninitialized constant Geocode
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing_not_from_s3_library'
/Users/macuser/Sites/hq_channel/vendor/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
/Users/macuser/Sites/hq_channel/config/initializers/geocode.rb:1
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:622:in `load_application_initializers'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:621:in `each'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:621:in `load_application_initializers'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:176:in `process'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/Users/macuser/Sites/hq_channel/config/environment.rb:21
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/railties/lib/tasks/misc.rake:4
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
I've had mysql installations that didn't allow underscores or dashes in the database names.
You could try changing the database name to application and then running rake db:create to see if it creates your database.
Also, you can try running rake with --trace to get a better idea of what's being included from where that's causing that error.