简体   繁体   中英

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.

The ruby-mysql gem was installed by way of Gemfile and loaded with "bundle install" and has been verified as version 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

"Mysql::ProtocolError: invalid packet:"

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. 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

Further note" I am using mongrel (1.1.5 x86-mingw32) which appears to load cleanly

Any suggestions would be really appreciated.

Doug

Problem has been solved. Managed to get the Mysql2 gem to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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