newbie problem: ActiveRecord::StatementInvalid

Please, I am just beginning to learn RoR, following the "Up and running" tutorial. setup: ruby and ror=latest; mysql 4.0.17; WEBrick.

#Created the app I had to add the -d mysql after looking in the forums, latest RoR does not defaults to mysql

rails -d mysql \chapter1

(MySQL) create database chapter1_development; grant all on *.* to 'ODBC@localhost';

ruby script/generate controller Greeting

At this point I should see at localhost:3000/greeting something like "an error message telling you that index is an unknown action." (the tutorial says) Instead I see this:

ActiveRecord::StatementInvalid in GreetingController#index Mysql::Error: Unknown system variable 'NAMES': SET NAMES 'utf8'

This is the response I get for EVERY request, even localhost:3000/rails/info/properties.

MySQL complains about an unknown system variable, NAMES. I searched the mysql docs, hoping this variable would be present in later versions of MySQL; so upgrading the database would solve the problem. But this variable is nonexistent, in any version of the database.

So what's going on?

Thanks to all

does this help:

a lot of people seem to have the same problem and a solution is suggested....

ps I just googled for: Mysql::Error: Unknown system variable 'NAMES': SET NAMES 'utf8' (not between speech marks and the above was top of the list baby yeah!

I also faced the same error. Mysql::Error: Unknown system variable 'NAMES': SET NAMES 'utf8' I found that in the config\database.yml file there is a line encoding: utf8 I solved this error by removing the line encoding: utf8 from the file config\database.yml file. Do this for development, test, production settings. It worked for me.

-Rohit

I have explained the solution in details on my blog http://rohitagarwal24.blogspot.com/ Rohit