Unable to install MySQL2 gem on Windows 7

前端 未结 7 1280
醉话见心
醉话见心 2020-12-01 14:39

I am getting the following error message while installing, let me know if I need to post more details.

I followed instructions from the following location: https:/

7条回答
  •  被撕碎了的回忆
    2020-12-01 15:12

    The specific version of mysql2 gem you're trying to install (0.2.4) not only lacks binaries for Windows, but have issues on Windows.

    Please install mysql2 gem without indicating the version:

    gem install mysql2
    

    Which will install latest version (0.2.6 at the time of my posting this) and also provides binaries for Windows which skip the compilation step.

    If you still want to force the compilation (because your version of MySQL differs from the one used to generate the binary gem, you will need to install RubyInstaller's DevKit from RubyInstaller website:

    http://rubyinstaller.org/downloads

    And follow the DevKit installation instructions from our wiki (that is linked from the download page)

    You will need to provide the path to both headers and libraries during the gem installation process, and adjust the MySQL installation location from the following instructions:

    subst X: "C:\Program Files (x86)\MySQL\MySQL Server 5.1" 
    gem install mysql2 --platform=ruby -- --with-mysql-dir=X: --with-mysql-lib=X:\lib\opt 
    subst X: /D
    

    The above command uses subst to avoid issues with path with spaces, which you should avoid always.

    Hope this helps.

提交回复
热议问题