1

使用 ruby​​ gem 'sequel',当我尝试时Sequel.connect("mysql://localhost"),我收到以下错误:

Sequel::AdapterNotFound: LoadError: require 'mysql' did not define Mysql::CLIENT_MULTI_RESULTS!
  You are probably using the pure ruby mysql.rb driver,
  which Sequel does not support. You need to install
  the C based adapter, and make sure that the mysql.so
  file is loaded instead of the mysql.rb file.

如何让这个 gem 连接到 MySQL 服务器?

系统:Win XP、Ruby 1.8.7、Mysql 5.1.51

4

2 回答 2

2

Found the solution on this thread: Unable to connect mysql from Sequel gem

Call gem('mysql') to specify use of the native sql driver before Sequel.connect().

(Upvotes for Jeremy Evans)

于 2011-08-10T17:00:10.473 回答
1

Sequel 是现有数据库适配器之上的 ORM。

您收到的错误是因为mysql尚未安装 gem。

你应该能够解决这个问题gem install mysql

libmysql.dll由于 Windows 上的 MySQL gem 是作为二进制文件提供的,因此对于系统中可用的依赖关系是非常明智的。

我向您推荐我整理的以下教程,以涵盖针对现代 MySQL 版本的 gem 的正确安装:

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

希望这可以帮助。

于 2011-08-08T20:05:01.340 回答