rails安装mysql的driver

Prerequisites


The Ruby DBI module includes the code that implements the general DBI layer, as well as a set of DBD-level drivers. Many of these drivers require that you have additional software installed. For example, the database driver for MySQL is written in Ruby and provides a binding to the Ruby MySQL module, which itself is written in C and provides a binding to the MySQL C client API. This means that if you want to write DBI scripts to access MySQL databases, you'll need to have both the Ruby MySQL module and the C API installed. For further information on the Ruby MySQL module, see the document referenced in the "Resources" section. Here, I assume that the MySQL module is installed and available for use by DBI.

Installation


After you have satisfied the prerequisites described in the previous section, you can install the Ruby DBI module, which can be obtained from the following site:

   http://rubyforge.org/projects/ruby-dbi/
The DBI module is distributed as a compressed tar file, which you should unpack after downloading it. For example, if the current version is 0.1.1, the distribution file can be unpacked using either of the following commands:
   % tar zxf dbi-0.1.1.tar.gz
% gunzip < dbi-0.1.1.tar.gz | tar xf -
After unpacking the distribution, change location into its top-level directory and configure it using the setup.rb script in that directory. The most general configuration command looks like this, with no arguments following the config argument:
   % ruby setup.rb config 
That command configures the distribution to install all drivers by default. To be more specific, provide a --with option that lists the particular parts of the distribution you want to use. For example, to configure only the main DBI module and the MySQL DBD-level driver, issue the following command:
   % ruby setup.rb config --with=dbi,dbd_mysql 
After configuring the distribution, build and install it:
   % ruby setup.rb setup
% ruby setup.rb install
You might need to run the installation command as root.

The rest of this document uses the following notational conventions:

  • "DBI module" refers collectively to the DBI layer as well as the DBD-level drivers, unless context indicates that only the database independent layer is meant.
  • "DBD::Mysql" refers to the MySQL-specific database driver for DBI.
  • "Ruby MySQL module" refers to the module on which DBD::Mysql is built (that is, the module that provides the bindings to the MySQL C client library).


在整个操作的过程中
ruby setup.rb config --with=dbi,dbd_mysql
这句话是主要的问题,以前就是把这个选项搞错了


中间搜索到了很多有用的网站

http://www.kitebird.com/articles/ruby-mysql.html  这篇文章的主要引用,里面有一篇 Migrating from IIS to Apache 要看一下

http://www.rubyonrailsblog.com/articles/2006/09/04/installing-ruby-ruby-on-rails-mysql-and-rmagick-on-windows

这个里面提到了 Ruby, Ruby on Rails, MySQL and Rmagick on Windows


http://www.troubleshooters.com/codecorn/ruby/database/index.htm 里面有比较全的ruby数据库连接的信息


http://willh.org/~cfc/wiki/index.php/Ruby%E5%92%8C%E8%B3%87%E6%96%99%E5%BA%AB 这个网站不知道是干嘛的,不过提到了 DBI(database interface)

http://sqlrelay.sourceforge.net/sqlrelay/programming/rubydbi.html   里面有比较全的关于dbi的使用(
Programming with SQL Relay using the Ruby DBI API)http://del.icio.us/里搜索到了,这个网站不错
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值