Upgraded to ruby 1.8.7. Went to the script/console, executed a basic activerecord find command and received the following error :
Mysql::Error: Client does not support authentication protocol requested by server.
From the accompanying stack trace, it’s obvious that ActiveRecord is looking at the old mysql adapter that comes packaged with ruby 1.8.7.
from /usr/local/lib/ruby/1.8/mysql.rb:453:in `read'
from /usr/local/lib/ruby/1.8/mysql.rb:130:in `real_connect'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:in `connect'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:203:in `initialize'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `new'
Not sure why this is, but just decided to rename the default ruby mysql adapter and retry it :
sudo mv /usr/local/lib/ruby/1.8/mysql.rb /usr/local/lib/ruby/1.8/_mysql.rb
>> Location.find(151)
=> #<location id: 151, city: "Los Angeles", territory_desc: "State", territory: "California", country: "United States", continent: "North_America", wikipedia_url: "/wiki/Los_Angeles", approved: true, lat: #<BigDecimal:21843fc,'0.34052354E2',12(16)>, lng: #<bigdecimal :21843ac,'-0.118243549E3',12(20)>, created_at: "2010-03-02 21:07:06", updated_at: "2010-03-30 06:45:09", airport_id: 1>
</bigdecimal></location>
Success. Not sure why Rails wasn’t choosing the installed mysql adapter (2.8.1) over the default adapter.
Leave a comment »