簡體   English   中英

使用windows安裝mysql2時出錯

[英]Error installing mysql2 with windows

奇怪的是我可以用這個命令安裝mysql2: $ gem install mysql2 --platform=ruby -- '--with-mysql-lib="c:\\Program Files\\MySQL\\MySQL Server 5.5\\lib" --with-mysql-include="c:\\Program Files\\MySQL\\MySQL Server 5.5\\include"'以下是結果:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed mysql2-0.3.10
1 gem installed
Installing ri documentation for mysql2-0.3.10...
Installing RDoc documentation for mysql2-0.3.10...

但是當我運行bundle install (顯然我需要安裝很多gem),它無法安裝mysql2,所以bundle install停在那里,這真讓我瘋狂......任何人都可以幫忙嗎? 多謝了! 以下是bundle install的結果:

Installing mysql2 (0.3.8) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.

        c:/Ruby192/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
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:/Ruby192/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}/lib
        --with-libmysqllib
        --without-libmysqllib


Gem files will remain installed in G:/Desktop/20090319-/Rails Examples/ClockingI
T/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.8 for inspection.
Results logged to G:/Desktop/20090319-/Rails Examples/ClockingIT/vendor/bundle/r
uby/1.9.1/gems/mysql2-0.3.8/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.3.8), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.8'` succeeds before bundling.

在我的ubuntu機器上,必須首先運行apt-get install libmysqld-dev ,然后gem install mysql2 ...它就像一個魅力:)

嘗試從捆綁包外部安裝mysql,如果可以的話,從Gemfile中刪除mysql

 sudo gem install mysql --no-rdoc --no-ri -- 

--with MySQL的-配置=的/ usr /本地/ MySQL的/斌/ mysql_config

apt-get install libmysqld-dev

罰款,請下載mysql-connector-c-6.1.5-win32版本,解壓縮該文件夾,然后試試這個。

對我來說效果很好。

gem install mysql2 --no-ri --no-rdoc --platform = ruby​​ - --with-mysql-include = C:\\ mysql-connector \\ mysql-connector-c-6.1.5-win32 \\ include - 與MySQL的-LIB = C:\\ MySQL的連接器\\ MySQL的連接器-C-6.1.5-的win32 \\ lib中

您嘗試安裝的mysql2 gem版本在Windows上存在問題。

請安裝mysql2 gem而不指明版本:

gem install mysql2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM