If you receive the following error message Mysql::Error: Unknown system variable 'NAMES': SET NAMES 'utf8' when trying to run MySQL with ruby on rails it may be due to the version of MySQL you are running. I was receiving this error when running a basic ROR app as well as when trying to run a migration rake db:migrate.
Turns out I was using MySQL version 4.0.12-nt which is not supported with the most recent version of rails.
I had MySQL 5.1 running on a different port, so I also needed to update the database.yml file to specify the port. If you need to specify a MySQL port with rails, you need to add port: to the yml file...mine ended up looking like:
With those changes in place, I was then able to run my rails app and migrations.