简体   繁体   English

Windows上的Rails 3.0 Ruby-Mysql Gem-在控制台上无法在服务器上使用

[英]Rails 3.0 Ruby-Mysql Gem on Windows - works on Console not on the Server

I've installed Rails 3.0 with an existing version of MySQL 5.3.31 on a Windows XP machine running Ruby 1.8.7, but I am having difficulty connecting to the Mysql database. 我已经在运行Ruby 1.8.7的Windows XP计算机上安装了带有MySQL 5.3.31的现有版本的Rails 3.0,但是我很难连接到Mysql数据库。

The ruby-mysql gem was installed by way of Gemfile and loaded with "bundle install" and has been verified as version 2.9.4. ruby-mysql gem是通过Gemfile方式安装的,并装有“捆绑安装”程序,并已验证为2.9.4版。

When I run the application at the console and run a command such as User.all, it runs perfectly, but when I load up the application server side I receive the error 当我在控制台上运行该应用程序并运行诸如User.all之类的命令时,它可以完美运行,但是当我加载应用程序服务器端时,会收到错误消息

"Mysql::ProtocolError: invalid packet:" “ Mysql :: ProtocolError:无效数据包:”

So question is: why is the database accessible at the console, but not when running the server. 所以问题是:为什么可以在控制台上访问数据库,而在运行服务器时却不能访问。

I have also tried the following gems one at time in the Gemfile. 我还在Gemfile中一次尝试了以下宝石。 1) gem 'mysql' - which failed to connect either console or server side 2) gem 'mysql2' - which failed to connect either console or server side 3) gem 'mysql-ruby' - which got nowhere 1)gem'mysql'-无法连接控制台或服务器端2)gem'mysql2'-无法连接控制台或服务器端3)gem'mysql-ruby'-无法连接

Further note" I am using mongrel (1.1.5 x86-mingw32) which appears to load cleanly 进一步说明”我正在使用杂种(1.1.5 x86-mingw32),该杂种看上去可以干净地加载

Any suggestions would be really appreciated. 任何建议将不胜感激。

Doug 道格

Problem has been solved. 问题已解决。 Managed to get the Mysql2 gem to work. 设法使Mysql2 gem起作用。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM