error while trying to push database to heroku - mysql

I am trying to do a
$heroku db:push
this is the error I get
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138:in `union': can't convert Array into
String (TypeError)
from C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/Ruby/lib/ruby/gems/1.8/gems/taps-0.3.9/lib/taps/multipart.rb:2
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/Ruby/lib/ruby/gems/1.8/gems/taps-0.3.9/lib/taps/data_stream.rb:2
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
... 8 levels...
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.11/lib/heroku/command.rb:20:in `run'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.11/bin/heroku:13
from C:/Ruby/bin/heroku:19:in `load'
from C:/Ruby/bin/heroku:19
It is a brand new MySQL development database, the taps gem is installed. I have pushed this same database to multiple other heroku apps, those have all been deleted.

Have you checked the version of rack gem?
try making it rack (1.0.1)
i.e gem uninstall rack <version number>
then gem install rack 1.0.1
Hope this helps,
Regards,
Saurabh

Related

Can't get WAMP MySQL to work with Ruby on Rails

I am trying to use my WAMP MySQL for a Ruby on Rails installation on my Windows 7 system. I am getting errors (see below) when I try to start the rails WEBrick server.
I've installed the complete Ruby on Rails environment successfully, including the mysql2 gem. When installing the mysql2 gem, I referenced the location of the lib and includes folders of the WAMP mysql and it successfully installed:
C:\wamp\www\simple_cms>gem install mysql2 --no-document -- '--with-mysql-lib="C:\wamp\bin\mysql\mysql5.5.24\lib\" --with-mysql-include="C:\wamp\bin\mysql\mysql5.5.24\include\"
======================================================================================================
\ You've installed the binary version of mysql2.
It was built using MySQL Connector/C version 6.1.5.
It's recommended to use the exact same version to avoid potential issues.
At the time of building this gem, the necessary DLL files were retrieved from:
http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.5-winx64.zip
\ This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/README.
======================================================================================================
Successfully installed mysql2-0.3.18-x64-mingw32
1 gem installed
I copied the libmysql.dll from "C:\wamp\bin\mysql\mysql5.5.24\lib\libmysql.dll" to "C:\Ruby22-x64\bin\libmysql.dll".
I get the following error when I try to start WEBrick
C:\wamp\www\simple_cms>rails server
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler.rb:134:in `require'
from C:/wamp/www/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have also tried using the libmysql.dll included with the mysql2 gem located at "C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\mysql2-0.3.18-x64-mingw32\vendor\libmysql.dll" and copying that to "C:\Ruby22-x64\bin\libmysql.dll". That also gave the above errors.
I can access mysql from the command line:
C:\wamp\www\simple_cms>mysql --version
mysql Ver 14.14 Distrib 5.5.24, for Win64 (x86)
I'm not sure what I am doing wrong here. Any help would be appreciated.

Rails + Ubuntu + MySQL = Error

I have XAMPP installed on Ubuntu 12.04 and it all works.
I've also been using Rails for a while with PostgreSQL and it also worked fine.
Today, I tried creating a new app using mysql with mysql2 gem, and got an error while running rake db:create.
I first checked the other Rails/MySQL questions on SO, and will say:
MySQL is running
Using mysql2 gem
DB config looks correct (to me)
database.yml using socket: /opt/lampp/var/mysql/mysql.sock
Error:
/opt/lampp/lib/libmysqlclient.so.18: symbol SSL_accept, version OPENSSL_1.0.1 not defined in file libssl.so.1.0.0 with link time reference - /home/wwc/.rvm/gems/ruby-2.0.0-p353/extensions/x86_64-linux/2.0.0/mysql2-0.3.14/mysql2/mysql2.so
/home/wwc/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `require'
/home/wwc/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
/home/wwc/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/home/wwc/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/home/wwc/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/home/wwc/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/home/wwc/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/home/wwc/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/home/wwc/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/media/fat64/work/_active/josephzidell_rails/config/application.rb:7:in `<top (required)>'
/media/fat64/work/_active/josephzidell_rails/Rakefile:4:in `require'
/media/fat64/work/_active/josephzidell_rails/Rakefile:4:in `<top (required)>'
/home/wwc/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/home/wwc/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
You can try installing SSL libs using:
apt-get install libssl-dev
You can check the path that it has been installed in using:
apt-file list libssl-dev
you may need to install apt-file first by running:
sudo apt-get install apt-file
apt-file update
The Ruby 2.0.0 got problem with OpenSSL 1.0.1f
Check How can I ensure that Ruby uses an OpenSSL not vulnerable to Heartbleed? and you will realize that your Ruby's OpenSSL lib is not up-to-date
Follow these command (credit: https://coderwall.com/p/tptocq)
rvm pkg install openssl
rvm install 2.0.0 \
--with-openssl-dir=$HOME/.rvm/usr \
--verify-downloads 1
The new installed Ruby 2.0.0 on your machine will got the final OpenSSL version (1.0.1g), which also patched for the Heart Bleed.

Ruby Gem LoadError mysql2/mysql2 required

Im trying to setup my rails server on OSX 10.8 but I can't get my rails server to run.
- Currently Im using a Zend Server with mysql 5.1.
- I also have istalled brew and brew mysql.
- And I used: gem install mysql2 -- --srcdir=/usr/local/mysql/include --with-opt-include=/usr/local/mysql/include
the server worked already but now, I always get this loadError below.
This is what my Gemfile says:
ralphs-macbook-pro:admin-mockup zero$ bundle install
Using rake (10.0.2)
Using i18n (0.6.1)
Using multi_json (1.3.7)
Using activesupport (3.2.7)
Using builder (3.0.4)
Using activemodel (3.2.7)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.7)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.7)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.7)
Using activeresource (3.2.7)
Using annotate (2.5.0)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.7)
Using coffee-rails (3.2.2)
Using columnize (0.3.6)
Using debugger-ruby_core_source (1.1.5)
Using debugger-linecache (1.1.2)
Using debugger (1.2.2)
Using formtastic (2.2.1)
Using haml (3.1.7)
Using haml-rails (0.3.5)
Using hirb (0.7.0)
Using hpricot (0.8.6)
Using jquery-rails (2.1.4)
Using kgio (2.7.4)
Using mysql2 (0.3.11)
Using php_serialize (1.2)
Using polyamorous (0.5.0)
Using rabl (0.7.8)
Using railroady (1.1.0)
Using bundler (1.2.3)
Using rails (3.2.7)
Using raindrops (0.10.0)
Using randumb (0.3.0)
Using sass (3.2.3)
Using sass-rails (3.2.5)
Using squeel (1.0.13)
Using uglifier (1.3.0)
Using unicorn (4.4.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled
gem is installed.
And after starting rails s
/Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': cannot load such file -- mysql2/mysql2 (LoadError)
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /Users/zero/GitHub/admin-mockup/config/application.rb:7:in `<top (required)>'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.7/lib/rails/commands.rb:53:in `require'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.7/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.7/lib/rails/commands.rb:50:in `tap'
from /Users/zero/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.7/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Thx for any help!
Check for this solutions:
http://railsforum.com/viewtopic.php?id=50501
rake db:migrate giving error for mysql2
after that I changed my database.yml as follows:
development:
adapter: mysql2
socket: /usr/local/zend/mysql/tmp/mysql.sock
#host: 127.0.0.1
so that I used my local zend MySQL socket.
In my case the ""Can't connect to MySQL server on '127.0.0.1' (61) (Mysql2::Error)" was gone.
Thx #dinnouti for the usefull links above.

Problem with MySQL and Rails Server

Final edit: I played with a few different files got some more errors and then reinstalled rvm and everything else from the start, found a few fixes and edited them and finally everything works. thank you everyone for your help
Edit: I have noticed that it says Library not loaded: /usr/local/mysql-5.5.10-osx10.6-x86_64/lib/libmysqlclient.18.dylib (LoadError)
But I have mysql 5.5.11, how do I fix that?
I literally have searched for the past 3 hours, but found nothing that worked
Same error occurs when I either try to launch the server or generate a model
I have bundler and mysql2 gems.
builder (2.1.2)
bundler (1.0.12)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.17)
mime-types (1.16)
mysql2 (0.2.7)
I get the following output:
hrs772:demo kishinmanglani$ rails s
/Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2.rb:8:in `require': dlopen(/Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql-5.5.10-osx10.6-x86_64/lib/libmysqlclient.18.dylib (LoadError)
Referenced from: /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2.rb:8:in `<top (required)>'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `block in require'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
from /Users/kishinmanglani/rails_projects/demo/config/application.rb:7:in `<top (required)>'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:28:in `block in <top (required)>'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /Users/kishinmanglani/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Whenever you get load errors you should make sure you have all of the dependencies installed and in place.
Make sure you have gem mysql2 in your Gemfile.
Install bundler if you don't already have it with gem install bundler.
Run bundle (same as bundle install).
Then try running the server again.
mysql2 with rails 3.0.3 is give some error so try to update rails version with 3.0.6
it working fine so try

Installing mysql2 gem on mac with RVM is real pain

Step 1:--
rails s/usr/local/rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/lib/mysql2.rb:8:in `require': dlopen(/usr/local/rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)
Referenced from: /usr/local/rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Reason: image not found - /usr/local/rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/lib/mysql2.rb:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
from /Users/mohit/projects/lbs_admin/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands.rb:28:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
STEP 2:--
sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql-5.5.9-osx10.6-x86_64/lib/libmysqlclient.16.dylib /usr/local/rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Result:--
rails sWARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError)
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:68:in `establish_connection'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/railtie.rb:59:in `block (2 levels) in <class:Railtie>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/base.rb:1891:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/will_paginate-3.0.pre2/lib/will_paginate/finders/active_record.rb:31:in `enable!'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/will_paginate-3.0.pre2/lib/will_paginate/railtie.rb:9:in `block in <class:Railtie>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /Users/mohit/projects/lbs_admin/config/environment.rb:5:in `<top (required)>'
from /Users/mohit/projects/lbs_admin/config.ru:3:in `require'
from /Users/mohit/projects/lbs_admin/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:46:in `initialize'
from /Users/mohit/projects/lbs_admin/config.ru:1:in `new'
from /Users/mohit/projects/lbs_admin/config.ru:1:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:35:in `eval'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:35:in `parse_file'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:162:in `app'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:248:in `wrapped_app'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:213:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands/server.rb:65:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands.rb:30:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Step 3:--
sudo gem uninstall mysql2
sudo env ARCHFLAGS="-arch i386" gem install mysql2 -- --with-mysql-config=/usr/local/mysql-5.5.9-osx10.6-x86_64/bin/mysql_config
Current status:--
ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
rails -v
Rails 3.0.3
gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.7, 3.0.3)
actionpack (3.0.7, 3.0.3)
activemodel (3.0.7, 3.0.3)
activerecord (3.0.7, 3.0.3)
activeresource (3.0.7, 3.0.3)
activesupport (3.0.7, 3.0.3)
annotate-models (1.0.4)
arel (2.0.9)
builder (2.1.2)
bundler (1.0.12)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.19)
mime-types (1.16)
mysql2 (0.3.2)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.7, 3.0.3)
railties (3.0.7, 3.0.3)
rake (0.8.7)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27)
web-app-theme (0.6.3)
will_paginate (3.0.pre2)
locate mysql_config
/usr/local/mysql-5.5.9-osx10.6-x86_64/bin/mysql_config
/usr/local/mysql-5.5.9-osx10.6-x86_64/man/man1/mysql_config.1
bundle show mysql2
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2
locate libmysqlclient.16.dylib
/usr/local/mysql-5.5.9-osx10.6-x86_64/lib/libmysqlclient.16.dylib
How can I proceed?
I have the sam problem. What I did is doing;
gem install --version '0.2.7' mysql2
Then on your Rails's GemFile. Should look like this.
gem 'mysql2', '0.2.7'
Then try again. Hope it help.
Your stacktrace after Step 2 told you what to do:
Please install the mysql2 adapter: gem install activerecord-mysql2-adapter
Update
Also, upgrade your Rails to 3.0.7 - there are a number of security holes (and bugs) in 3.0.3.
Update
Looks like that error message from Rails is wrong, it should have read:
Please use the 0.2.x releases if you plan on using it in Rails <= 3.1
Ie. for anything less than 3.1 you need to pin mysql2 to the 0.2 release, and not allow it to use 0.3. To do this, change your mysql2 line in your Gemfile to this:
gem "mysql2", "~> 0.2"
Then re-run bundle install
rails sWARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
MySql version '0.2.7' solved my issue.
gem 'mysql2', '0.2.7'
Try this (but I cannot guarantee anything)
Check this post about how to
remove MySQL 5.5.
install MySQL 5.1 (I think I downloaded the 32bit DMG version)
Follow this post to create the GEM.
Hopefully it will work after this. I'll cross my fingers for you.
The above problem occurs presently on EngineYard App Cloud with Ruby 1.9.2 and Rails 3.0.3. Using mysql 2.8.1 barfs b/c EY sets mysql2 adapter. Using mysql2 0.3.2 barfs. So I was seriously stumped. Props to Richard Soutar's answer. It worked.