Unable to install MySQL2 gem on Windows 7

前端 未结 7 1270
醉话见心
醉话见心 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:10

    Start with RailsInstaller.

    This is assuming you are running the mysql server locally (local development), and your Ruby is compiled 32-bit. (Check ruby -v. x64 || i386.)

    Download the mysql-community-web-installer. In the top right select 32-bit. You pretty much just need the Server. The Workbench is handy also.

    The gem command needs a path without spaces, so use subst:

    subst X: "C:\Program Files (x86)\MySQL\MySQL Server 5.6"
    gem install mysql2 -v=0.3.13 --platform=ruby -- --with-mysql-dir=X:
    

    You will need libmysql.dll in the PATH -- the easiest thing is just to copy it to Ruby's bin directory:

    copy "C:\Program Files (x86)\MySQL\MySQL Server 5.6\lib\libmysql.dll" "C:\RailsInstaller\Ruby2.0.0\bin"
    

    NOTES

    Don't do this from PowerShell! (DevKit has trouble changing path info in powershell.)

    Make sure all libraries are 32-bit, since RailsInstaller's ruby etc. are all compiled 32-bit and need to link to 32-bit libraries.

    If you don't want a server locally, just install the C Connector, and do these instructions with that directory and libmysql.dll. Don't mix and match -- make sure the .dll matches the version you compiled the gem against.

提交回复
热议问题