安装ruby环境,用mysql数据库,总是报错,调了一下午,网上方法都用了也不管事

Python017

安装ruby环境,用mysql数据库,总是报错,调了一下午,网上方法都用了也不管事,第1张

make的时候需要调用ruby很多编译前的参数.一些信息make不知道的话会不知道如何建库.

我个人的建议是根据你安装的ruby路径和版本信息把配置选项补充全.下面是我电脑上面的配置,你可以借鉴一下.据我分析应该能解决你的问题.

Provided configuration options:

--with-opt-dir

--with-opt-include

--without-opt-include=${opt-dir}/include

--with-opt-lib

--without-opt-lib=${opt-dir}/usr/lib

--with-make-prog

--without-make-prog

--srcdir=.

--curdir

--ruby=/usr/local/ruby-2.1.2/rubies/ruby-2.1.2/bin/ruby

配置 database.yml 文件

development:

adapter: mysql2

encoding: utf8 (字符集)

database: database_name×××(数据库名)

username: root (用户名)

password: ××××××(用户密码)

host: localhost

pool: 5 (连接池数量)

timeout: 5000 (超时时间)

ruby在windows下使用mysql要注意

要装mysql2

要指定mysql-connector的目录,注意你的目录可能跟我的不一样

gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector\"'

我当时用的是ruby2.1.1,不过应该差别不大