mysql - gem mysql2 未安装在 ruby​​ on rails 上

标签 mysql ruby-on-rails c ruby mysql2

<分区>

我安装了以下版本:

  • ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
  • rails 4.0.2
  • DevKit-tdm-32-4.5.2-20111229-1559-sfx
  • rubygems-2.1.11
  • MySQL 服务器 5.6
  • mysql-connector-c-noinstall-6.0.2-win32-vs2005

我运行了以下三个命令:

$ gem i mysql2

$ gem install mysql2 -- '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.6\lib" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.6\include" --with-mysql-dir="C:\Program Files\MySQL\MySQL Server 5.6"'

$ gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector-c-noinstall-6.0.2-win32-vs2005\lib" --with-mysql-include="C:\mysql-connector-c-noinstall-6.0.2-win32-vs2005\include" --with-mysql-dir="C:\mysql-connector-c-noinstall-6.0.2-win32-vs2005"'

以上三个命令有以下错误:

* 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.

最佳答案

sudo apt-get install libmysql-ruby libmysqlclient-dev

看这题https://stackoverflow.com/a/3608756/1970061

关于mysql - gem mysql2 未安装在 ruby​​ on rails 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21328008/

相关文章:

c - `-V` 标志如何既是 `--verbose` 又是 `--version` ?

mysql - 将 AUTO_INCREMENT 列添加到 Rails 模型时出错 - MySQL

php - PDO 如何知道 MySQL 中最后插入的 id?

mysql - 对 rails 的 mysql 查询的更正

ruby-on-rails - Ruby - 无法在 45 秒内绑定(bind)到锁定端口 7054 (Selenium::WebDriver::Error::WebDriverError)

ruby-on-rails - 在 PDF 生成过程完全完成后调用 rails 的 Action 。 - Prawn + rails

C程序文件传输,在客户端打印出服务器端错误

php - MySQL 的 HTML 表单输入

mysql - 带有聚合函数的子查询 SQL

无法通过 malloc