我正在try 用Rails 3.2.3安装mysql2 gem,但失败了:

★  bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2) 
Using i18n (0.6.0) 
Using multi_json (1.2.0) 
Using activesupport (3.2.3) 
Using builder (3.0.0) 
Using activemodel (3.2.3) 
Using erubis (2.7.0) 
Using journey (1.0.3) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.2) 
Using actionpack (3.2.3) 
Using mime-types (1.18) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.4.4) 
Using actionmailer (3.2.3) 
Using arel (3.0.2) 
Using tzinfo (0.3.32) 
Using activerecord (3.2.3) 
Using activeresource (3.2.3) 
Using bundler (1.1.3) 
Using coffee-script-source (1.2.0) 
Using execjs (1.3.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.6.6) 
Using rdoc (3.12) 
Using thor (0.14.6) 
Using railties (3.2.3) 
Using coffee-rails (3.2.2) 
Using jquery-rails (2.0.2) 
Installing mysql2 (0.3.11) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/rarneson/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
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
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/rarneson/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib


Gem files will remain installed in /Users/rarneson/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/rarneson/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.

我正在运行bundle安装,这在我的文件中:

gem 'mysql2', '~> 0.3.11' 

我目前正在通过MAMP运行MySQL.我不确定这是否是一个坏主意,我应该运行一个香草MySQl,但我目前的问题似乎只是安装了gem.我在stackoverflow上看到了很多这样的问题,但它们看起来都有点不同,或者有非常复杂的解决方案.我有什么遗漏吗?简单点?什么蠢事?如有必要,我可以从文件中提供其他信息.我读过一些人在开发中使用SQLite,然后在prod中测试MySQL,但这听起来是一个非常可怕的 idea .

推荐答案

我最终只是安装了一个新的MySQL副本,没有使用MAMP,这就成功了.还必须确保安装64位版本,而不是32位.

Mysql相关问答推荐

如何从MySQL数据库中提取入职第一个月的工作天数?

使用字符串文字与使用日期文字时的SQL行为

WordPress的sql命令从帖子中删除随机文本

PythonAnywhere中SSH到MySQL数据库无限期挂起,SSH正确,workbench可以完美连接

如何通过SQL来计算到达特定值的行的数量

获取每个参数的记录,不重复

特定时间段内每个客户的运行总计

根据 Power Query 中的条件替换值

SQL查询以查找两个特定行的总和

Mysql如何分行分词

MySQL 在第一个匹配行后停止搜索 N 行(不是 LIMIT)

如何替换 SELECT 查询中重复记录的列?

通过 Gorm 查询模型

FreeBASIC 中的 MySQL 访问读取

MySQL - 如何 Select 值在数组中的行?

INSERT ... 使用 WHERE 进行重复的密钥更新?

如何在 MySQL 中为用户设置默认架构

ASP.NET EntityFramework 获取数据库名称

Mysql中int(10)的最大大小是多少

'LIKE ('%this%' OR '%that%') and something=else' 不起作用