mysql - Rails、MySQL 和雪豹

标签 mysql ruby-on-rails ruby osx-snow-leopard

我使用我们在 WWDC 获得的光盘升级到了 Snow Leopard。

尝试运行我的一些 Rails 应用程序现在提示 sql

    (in /Users/coneybeare/Projects/Ambiance/ambiance-server)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
Importing all sounds in /Users/coneybeare/Projects/Ambiance/ambiance-sounds/Import 32/Compressed/

 -- AdirondackPeepers.caf
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
dlopen(/opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib
  Referenced from: /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
  Reason: image not found - /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

(See full trace by running task with --trace)

我可以发誓我以前修过一次。问题是

sudo gem install mysql

不起作用并给出错误:

 Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/opt/local/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no


Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

有没有人让mysql在雪豹上使用rails?如果是这样,你的设置是什么?更好的是,我能做些什么来重现它?

最佳答案

我刚刚经历了同样的痛苦……这对我有用:

  1. 从 mysql.com 下载/安装 64 位 MySQL 5.1.37
  2. 运行以下命令:

    sudo gem update --system

    sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

我还卸载了我 10.5 天以来 float 的所有 mysql gem,如果上述方法不适合您,可能会这样做:)

关于mysql - Rails、MySQL 和雪豹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/991708/

相关文章:

mysql - 简单的列更改查询在 MySQL 5.7 中不起作用

ruby-on-rails - 在 Ruby on Rails 中发送 SOAP 请求的最佳方式是什么?

ruby - 在数组中找到 2 个缺失数字的最快方法

ruby-on-rails - noi4r gem 安装问题

PHP MYSQL 分页列出所有字段

php MySql 白页

mysql - 如何在 GROUP BY 查询中为每个组返回特定​​列的最频繁值?

javascript - Firefox 中的混合内容阻止行为

ruby-on-rails - 如何订购字母列表 ("a","b","c",... ,"z","aa","ab")? String#succ 和 <=> 在这种情况下似乎不能很好地协同工作

ruby-on-rails - rails 。添加 "count"列,其中包含关联表中的值总和