From: zig Date: 2007-01-29T07:20:08+09:00 Subject: Re: mysql-ruby won't connect On Jan 24, 7:14 am, Mat Schaffer wrote: > Anyway, before you compile the gem insert the following at line 108 > in mysql.h (probably /usr/local/mysql/include/mysql.h) > > #if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined > (__USE_MISC) > typedef unsigned long ulong; /* Short for unsigned long */ > #endif Alright, I've done this step. > > Then build the gem: > sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql # not > sure if that mysql-dir field is necesary, but I did it anyway Actually, I'm trying to install directly from the mysql-ruby tarball, rather than gem. After I run $ ruby extconf.rb --with-mysql-dir=/usr/local/mysql $ make $ ruby test.rb nonexistenthost nonexistentuser stupidpassword I continue to get errors of the form 179) Error: test_sqlstate(TC_MysqlStmt2): Mysql::Error: Access denied for user 'lethe'@'localhost' (using password: NO) test.rb:441:in `new' test.rb:441:in `setup' In other words, the test suite is not receiving the hostname and login that I'm specifying on the command line, rather it's defaulting to my userlogin and localhost. Don't know why. I try it your way too, though. sudo gem install mysql (the newest version I can get this way is apparently 2.7, whereas my tarball is 2.7.3). But no difference: I can connect to the database in irb, but not from a web script. I continue to get the error [Sun Jan 28 13:55:32 2007] [error] mod_ruby: /usr/local/apache2/htdocs/ eruby/dbtest.rhtml:9:in `real_connect': Can't connect to MySQL server on 'localhost' (49) (Mysql::Error) from apache logs. So real_connect works in irb, but not in a mod_ruby script. I'm not sure whether that is related to the failure of the mysql test suite to get the user/pass I specify on the command line. > > Now password authentication is working for me again. I'd also remove > those lines from mysql.h once you're done. I have no idea what they'd > do when trying to compile other plugins. > > I haven't researched what the exact cause of the problem, but this > seems like a workaround till mysql and the mysql gem get back in sync. > > Hope it helps! > -Mat Thanks for your help, Mat. This is pretty frustrating, so it's nice to have people try to help. Unfortunately, this doesn't seem to have helped me. Maybe our problems are different? Do you have any further insight to share about that?