2

Rails 要求我成功安装 gem install mysql2 并在尝试时收到以下错误。那么这种错误的主要问题是什么?错误详情如下: 由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件。检查 mkmf.log 文件以获取更多详细信息。您可能需要配置选项。

Provided configuration options:
--with-opt-dir
--without-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=/usr/local/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 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.7 for  inspection.
   Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.7/ext/mysql2/gem_make.out

此错误发生在结果中

       sudo gem install mysql2

安装mysql有什么问题吗?请告诉您对此的了解,我非常感谢您花时间阅读我的问题。

谢谢

4

3 回答 3

2

如果您还没有安装 mysql,请尝试添加以下完整包:

sudo apt-get install mysql-server mysql-server-5.1 libmysql-ruby libmysqlclient-dev mysql-client-5.1 mysql-common

还要检查这个heroku db:pull cant connect to my DB in ubuntu

于 2011-12-23T13:05:43.843 回答
2

这应该可以解决您的问题

sudo apt-get install libmysqld-dev libmysqlclient-dev mysql-client

gem install mysql2
于 2014-12-25T21:36:03.053 回答
0

我在第一次安装 Rails 时遇到了很多问题,尤其是 mysql……尝试阅读这篇文章: 安装 mysql2 时出错:无法构建 gem 原生扩展

于 2011-12-23T12:40:49.623 回答