win8 下ruby 连接 mysql5.6的问题
z5wjz 2013-06-04 12:12:25 环境如题,ruby版本为ruby 2.0.0p0 (2013-02-24) [x64-mingw32]
现象:连不上mysql
执行gem install mysql
报错如下
C:\windows\system32>gem install mysql
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for main() in -llibmysql... 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
--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=C:/Ruby200-x64/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/
--with-libmysqllib
--without-libmysqllib
Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
经查询网上资料,我把D:\Program Files\MySQL\MySQL Server 5.6\lib\libmysql.dll 已经复制到了C:\Ruby200-x64\bin 目录
并且下载了mysql-2.8.2-x86-mingw32.gem,且成功执行gem install mysql-2.8.2-x86-mingw32.gem
但故障依旧,在我调用含有requier "mysql"的程序时,依然会报错如下:
C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- mysql/mysql_
api (LoadError)
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql-2.8.2-x86-mingw32/lib/mysql.rb:6:in `rescue in <top (required
)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql-2.8.2-x86-mingw32/lib/mysql.rb:2:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from aa.rb:1:in `<main>'
求高手解答。