简体   繁体   English

Windows 7 x64中Rails的MySQL驱动程序

[英]MySQL driver for Rails in Windows 7 x64

I've got problem with connecting to MySQL database on my freshly installed Windows 7 machine. 我在新安装的Windows 7机器上连接MySQL数据库时遇到问题。 I'm getting this error when I try to migrate my database. 我尝试迁移数据库时遇到此错误。

!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install 
the mysql gem and try again: gem install mysql.
rake aborted!
193: %1 is not valid Win32 application - C:/Ruby/lib/ruby/gems/1.8/gems/mysql-2.8.1-x86-mswin32/lib/1.8/mysql_api.so

I currently have installed 我目前已安装

ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
mysql version 5.0.86  for Win64
gem 1.3.1
mysql-2.8.1-x86-mswin32

而在Windows 7上运行的轨道,我的同事也有类似的问题,他不得不从一个替换的libmysql.dll(在PATH) InstantRails的

I spent hours trying to get MySQL and Rails to play nicely on Windows (albeit XP, both 32 and 64-bit versions). 我花了好几个小时试图让MySQL和Rails在Windows上运行得很好(尽管是XP,32位和64位版本)。 I finally gave up since my production box was running Linux (on which Rails and MySQL play very nicely) and just used SQLite 3 for development. 我终于放弃了,因为我的生产盒运行Linux(Rails和MySQL非常好地运行)并且只使用SQLite 3进行开发。 No headaches to get it working and it runs fast enough for development purposes. 没有令它头疼的工作,它运行得足够快,可用于开发目的。

However, I did hear of some people that had luck replacing one of the DLLs provided by the gem with one provided by the official MySQL distribution. 但是,我确实听说有些人幸运地用官方MySQL发行版提供的一个DLL替换了gem提供的一个DLL。 Also, some people simply didn't have this DLL at all which was causing problems. 此外,有些人根本没有这个DLL导致问题。 In the end, it didn't work for me, but hopefully you will have more luck. 最后,它对我不起作用,但希望你会有更多的运气。

For Rails or DataMapper or whatever to talk to MySQL you need a 32-bit driver in Rails\\bin. 对于Rails或DataMapper或与MySQL交谈的任何内容,您需要在Rails \\ bin中使用32位驱动程序。 The driver is called libmysql.dll. 该驱动程序称为libmysql.dll。 Even if you have a 64-bit server you need a 32-bit driver. 即使您有64位服务器,也需要32位驱动程序。

64-bit driver will fail will ruby/gems/1.8/gems/do_mysql-0.10.2-x86-mingw32/lib/do_mysql/1.8/do_mysql.so: 193: %1 is not a valid Win32 application. 64位驱动程序将失败将ruby / gems / 1.8 / gems / do_mysql-0.10.2-x86-mingw32 / lib / do_mysql / 1.8 / do_mysql.so:193:%1不是有效的Win32应用程序。

A wrong 32-bit version will crash with memory allocation error or something weird like that (suggested solution to take libmysql.dll from another project may not work with newer versions of MySQL). 错误的32位版本会因内存分配错误或类似奇怪的东西而崩溃(从另一个项目中获取libmysql.dll的建议解决方案可能不适用于较新版本的MySQL)。

I am new to this rails. 我是这个轨道的新手。 I just have passed the same issue in vista. 我刚刚在vista中传递了同样的问题。 after downloading libmySQL.dll (in the PATH) with the one from InstantRails it starts working. 在使用InstantRails中的libmySQL.dll(在PATH中)下载后,它开始工作。

sukumaaar@gmail.com sukumaaar@gmail.com

解决这个问题的方法是简单地安装32位版本的mysql。

Fast forward to March 2012. I solved this problem on windows 7 x64) by renaming my Ruby\\b\\bin\\libmysql.dll and then copying libmysql.dll from C:\\Program Files (x86)\\MySQL\\MySQL Connector C 6.0.2\\lib\\opt to Ruby\\bin 快进到2012年3月。我通过重命名我的Ruby \\ b \\ bin \\ libmysql.dll,然后从C:\\ Program Files(x86)\\ MySQL \\ MySQL Connector C 6.0复制libmysql.dll,在Windows 7 x64上解决了这个问题。 2 \\ lib \\ opt到Ruby \\ bin

There was a newer version of libmysql.dll at C:\\Program Files (x86)\\MySQL\\MySQL Workbench CE 5.2.37 but the gem didn't like the non 6.x version. 在C:\\ Program Files(x86)\\ MySQL \\ MySQL Workbench CE 5.2.37上有一个更新版本的libmysql.dll但是gem不喜欢非6.x版本。

Could this be related to Ruby on Rails Win7 x64? 这可能与Ruby on Rails Win7 x64有关吗? ? If so, what was the fix again (couldn't figure it out from the first answer) ? 如果是这样,再次修复了什么(无法​​从第一个答案中找到答案)?

另一个对我有用的选择是下载32位版本的mysql for windows并保留libmysql.dll并将此DLL的位置添加到windows PATH。

Adding the libmySQL.dll from InstantRails to a dir in my path worked for me too. 将InstantRails中的libmySQL.dll添加到我路径中的目录也为我工作。 It's really sad that we have to do this sort of thing though. 我们必须做这种事情真的很难过。 I'd like to see the gem, or MySql itself, install this DLL properly. 我想看看gem或MySql本身正确安装这个DLL。

I'm running the current versions of everything on WinXP SP3: Ruby 1.9.2p0, MySQL 5.5, mysql 2.8.1. 我在WinXP SP3上运行当前版本的所有版本:Ruby 1.9.2p0,MySQL 5.5,mysql 2.8.1。 This issue is still present and to fix it I had to copy the Instant Rails libmysql.dll into my C:\\Ruby192\\bin directory. 此问题仍然存在,要解决此问题,我必须将Instant Rails libmysql.dll复制到我的C:\\ Ruby192 \\ bin目录中。 I initially copied the libmysql.dll file that came with MySQL 5.5 but that caused a seq fault! 我最初复制了MySQL 5.5附带的libmysql.dll文件但导致了seq错误!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到Qt 5.4 Windows msvc x64 mysql驱动程序 - Qt 5.4 windows msvc x64 mysql driver not found 在Windows 7 x64上安装mysql2错误无法正常工作 - Error installing mysql2 with windows 7 x64 does not work Mysql2,RoR和Windows 8 x64的问题 - Issue with Mysql2, RoR, and Windows 8 x64 MySQL 5.6.26(Windows 8.1 x64):设置MySQL根用户密码的麻烦 - MySQL 5.6.26 (Windows 8.1 x64): Trouble with setting a password for the root MySQL user x64 PHP / MYSQL构建是否支持64位Windows Server上的完整64位时间戳 - Will a x64 PHP/MYSQL build support full 64bit timestamps on a 64bit Windows Server 在虚拟化的Windows 2003 x64服​​务器上使用ASP连接到MySQL数据库 - Connecting to MySQL database with ASP on a virtualized Windows 2003 x64 server 如何在Windows x64机器上使用VS 2010构建MySQL连接器c ++? - How to build MySQL connector c++ with VS 2010 on a Windows x64 machine? Windows 10 x64的MySQL MSI安装,更改安装文件夹? - Mysql msi installation for windows 10 x64, change installation folder? 在Ruby on Rails Windows 7 64x上安装Mysql gem - Installing Mysql gem on Ruby on Rails Windows 7 64x Python:如何在Windows 7 x64上安装mysqldb? - Python: How to install mysqldb on windows 7 x64?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM