0
votes

I'm currently trying to get the following to work together, to no avail:

Rails 3.1.1 MAMP 2.0.2 mysql2 5.5.9 Ruby 1.9.2 Mac OSX 10.7 (lion)

Everything appears installed.. mysql2 and rails show up in my gem list. I used the instructions found here to install mysql2 and it seemed to go smoothly:

http://blog.mirotin.net/35/mamp-1-9-5-mysql-5-5-9-and-ruby-mysql2

I've also specified the MAMP socket in my database.yml file: socket: /Applications/MAMP/tmp/mysql/mysql.sock

My rails application runs fine with sqlite3, but when I change database to mysql2 and try to run webrick, I get a generic ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished) message.

What am I missing?

1
Not really an answer, just an alternative: ruby.railstutorial.org/ruby-on-rails-tutorial-book Read the first chapter It's a free book. It'll help you setup ruby with rvm, git, rails server, sqlite and push to heroku for production. - cnandreu

1 Answers

0
votes

You have to downgrade to mysql 5.1. I had the same problem. Then you need to install the mysql2 gem with the following command:

env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Also, you may want to try replacing gem 'mysql2' with gem 'mysql2', '< 0.3'