无法让 Rails、MAMP、mysql2 协同工作
我目前正在尝试让以下内容一起工作,但无济于事:
Rails 3.1.1 曼普2.0.2 mysql2 5.5.9 红宝石 1.9.2 Mac OSX 10.7 (lion)
一切似乎都已安装。mysql2 和rails 显示在我的gem 列表中。我使用此处找到的说明来安装 mysql2,似乎进展顺利:
http://blog.mirotin.net/35/mamp-1-9-5-mysql-5-5-9-and-ruby-mysql2
我'我们还指定了 MAMP 套接字在我的database.yml文件中: socket: /Applications/MAMP/tmp/mysql/mysql.sock
我的rails应用程序在sqlite3上运行良好,但是当我将数据库更改为mysql2并尝试运行webrick时,我得到一个通用的ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished) 消息。
我缺少什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你必须降级到mysql 5.1。我也有同样的问题。然后,您需要使用以下命令安装 mysql2 gem:
另外,您可能需要尝试将
gem 'mysql2'
替换为gem 'mysql2', '<; 0.3'
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:
Also, you may want to try replacing
gem 'mysql2'
withgem 'mysql2', '< 0.3'