0
votes

I've just starting ruby on rails and I am still busy setting everything up running.. the problem that I encounter is that it keeps saying that mysql2 is not part of a bundle.. I have googled it obviously but the solutions didn't seem to work

sudo gem install mysql2 

etc..

the stuff I get is

$ rake db:create rake aborted! Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (mysql2 is not part of the bundle. Add it to Gemfile.) /Library/Ruby/Gems/1.8/gems/bundler-1.3.2/lib/bundler/rubygems_integration.rb:214:in gem' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:3 /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:inrequire' /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:inload_dependency' /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:inresolve_hash_connection' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:29:in spec' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:inestablish_connection' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:90:in create_database' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62 /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62:ineach' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62 Tasks: TOP => db:create (See full trace by running task with --trace)

Anyone here knows the solution for me? ( p.s. I see alot people saying that it has to be added to the gem config but how? )

1
Read the error page: gem install activerecord-mysql2-adapterZippie
i did.. but it keeps saying the same error..Reshad

1 Answers

1
votes

You should make sure your Gemfile (located in the root of your project) includes

gem 'mysql2'

Then run the bundle install to install it.

I believe the activerecord-mysql2-adapter gem is installed as a dependency, but you can also add

gem 'activerecord-mysql2-adapter'

If it still requests it.