[Rails] Re: Mysql error running ruby script/generate

chris schelcj at pobox.com
Tue Aug 8 21:59:52 GMT 2006


Jared wrote:
> Dominik Wei-Fieg wrote:
>> alex wrote:
>>> Peter Michaux wrote:
>>>> Strange that the error has a captial 'M'
>>> 
>>> No, that looks about right - there's a line like:
>>> 
>>>   include Mysql
>>> 
>>> that's failed somewhere.
>> 
>> I have found a workaround: simply putting the following line into the 
>> file 
>> activerecord-1.13.0/lib/active_record/connection_adapters/mysql_adapter.rb 
>> solves the problem:
>> 
>> require 'active_record/vendor/mysql.rb'
>> 
>> But this is only a hack... I would like to know what's wrong with my 
>> setup. I'll post it if I find it out.
> 
> 
> Fair warning.  I originally had the 'uninitialized constant Mysql'
> problem.  I tried the solution here, which has worked for some people.
> For me, however, it caused another error, the "lost connection to mysql
> server during query" error which is discussed here:
> http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems
> I was able to fix both problems by removing the line 'require
> 'active_record/vendor/mysql.rb' and properly installing the Mysql gem.

doing the require 'active_record/vendor/mysql.rb' doesn't use the mysql 
gem.
you get the ver, it caused another error, the "lost connection to mysql
> server during query" error which is discussed here:
> http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems
> I was able to fix both problems by removing the line 'require
> 'active_record/vendor/mysql.rb' and properly installing the Mysql gem.

doing the require 'active_record/vendor/mysql.rb' doesn't use the mysql 
gem.
you get the 'uninitialized constant Mysql' message because the load of 
the mysql gem failed, but didnt' raise an exception. if it had the above 
require would have been called. the problem is with mysql_config. the 
fix is below

http://www.mail-archive.com/dbi-users@perl.org/msg27851.html

unless there is a way to pass in ldflags to a gem install(i didn't find 
a way) you will need to edit mysql_config directly. do an uninstall of 
the mysql gem and then reinstall and remove that require. i am using 
mysql-5.0.22
hope this helps.

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list