November 28th, 2009, 03:39 PM
MySQL and Ruby
How do I access MySQL with ruby? Everytime I try to install the mysql gem I get a lot of No definition errors.
I figured it out after many frustrating hours and a lot of time spent searching the Internet.
To install the gem I used this command
gem install --no-rdoc --no-ri mysql -- --with-mysql-dir="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
Then I get a no access allowed for root with password = yes. So, I removed the password on root and now it seems to work though I have not yet tried to write to the database, but if I create a controller like
script/generate controller Hello index
and access localhost:3000/hello, the default page comes up as it should which it would not do when the mysql gem was not installed properly. Now if only I could figure out how to get rails to access my MySQL database when the root user has a password, I would be doing great. At least for now, I have it working somewhat.
Last edited by Z.K.; November 30th, 2009 at 01:14 AM.