首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >在此计算机上可用的gem中找不到gem 'mysql2 (>= 0) ruby

在此计算机上可用的gem中找不到gem 'mysql2 (>= 0) ruby
EN

Stack Overflow用户
提问于 2013-09-04 13:36:21
回答 1查看 3.2K关注 0票数 0

我在我的计算机上安装了rails,它是根据以下说明制作的-https://coderwall.com/p/auvm9g

安装新项目时- rails new my_project -d mysql

代码语言:javascript
代码运行次数:0
运行
复制
    Installing mysql2 (0.3.13) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/albert/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** 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/albert/.rvm/rubies/ruby-1.9.3-head/bin/ruby
    --with-mysql-config
    --without-mysql-config


Gem files will remain installed in /Users/albert/.rvm/gems/ruby-1.9.3-head@kyrgyz-tours/gems/mysql2-0.3.13 for inspection.
Results logged to /Users/albert/.rvm/gems/ruby-1.9.3-head@kyrgyz-tours/gems/mysql2-0.3.13/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.

谢谢大家!已安装Gem mysql2 :)

EN

回答 1

Stack Overflow用户

发布于 2013-09-04 13:45:31

您的错误似乎是您的系统中没有安装mysql,请安装mysql-servermysql-client和必要的库,例如:libmysql-dev.

代码语言:javascript
代码运行次数:0
运行
复制
 -----
 mysql.h is missing.  please check your installation of mysql and try again.
 -----

你可以关注http://ariejan.net/2007/12/12/how-to-install-mysql-on-ubuntudebian/

如果Mac os http://www.randomactsofsentience.com/2013/05/gem-install-mysql2-missing-mysqlh-on-os.html

也是

使用像Homebrew或MacPorts这样的包管理器使得修复这个问题变得相当简单。直接来自甲骨文的MySQL的二进制发行版和与OS本身捆绑在一起的发行版没有开发头文件,mysql.h就是其中之一。

代码语言:javascript
代码运行次数:0
运行
复制
brew install mysql
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18606108

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档