`
yNoooo
  • 浏览: 41265 次
  • 性别: Icon_minigender_2
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

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/里搜索到了,这个网站不错
分享到:
评论

相关推荐

    rails配置sqlserver2000

    在Ruby on Rails框架中,与SQLServer 2000集成可能会比与其他常见的数据库系统(如MySQL或PostgreSQL)稍复杂一些,因为SQLServer 2000的兼容性问题和缺少官方支持。然而,通过一些第三方库和适当的配置,我们仍然...

    go-on-rails:使用Rails开发或生成Golang应用程序

    on-rails生成的Go API中获取用户的信息先决条件Rails 4.2+(不支持Rails 6,需要您的帮助) Golang 1.10.x(主要与github.com/go-sql-driver/mysql兼容)安装将此行添加到您的应用程序的Gemfile中: gem 'go-on-...

    dbconfig:遵循 Rails 约定读取 database.yml 文件的 Golang 包

    数据库配置 Golang 包按照 rails database.yml 约定读取数据库设置,请参阅包括带有环境变量的嵌入式 erb 标签,并为 github.com/lib/pq 和 github.com/go-sql-driver/ 生成连接字符串mysql 驱动程序。安装 go get -...

    完整Web开发的go-gin

    在Go中,通常使用`database/sql`包和特定的驱动(如`github.com/go-sql-driver/mysql`)来与MySQL交互。这涉及SQL查询、事务处理、数据模型设计等内容。 3. **Swagger接口文档支持**:Swagger(现更名为OpenAPI ...

    Laravel开发-laravel-envol .zip

    它的设计灵感来源于Ruby on Rails,强调了代码的可读性和简洁性。Laravel支持MVC(模型-视图-控制器)架构模式,提供了丰富的库和工具,如Eloquent ORM、Artisan命令行工具、Blade模板引擎、队列服务等,极大地提高...

    message_me

    5. **数据库集成**:存储用户信息、聊天记录等数据,开发者可能使用 ActiveRecord(Ruby on Rails 的一部分),或者其他ORM(对象关系映射)库,如 Sequel,连接到像 PostgreSQL、MySQL 或 SQLite 这样的数据库。...

    Laravel开发-slimphp-vanilla

    'driver' =&gt; 'mysql', 'host' =&gt; 'localhost', 'database' =&gt; 'my_database', 'username' =&gt; 'root', 'password' =&gt; '', 'charset' =&gt; 'utf8mb4', 'collation' =&gt; 'utf8mb4_unicode_ci', 'prefix' =&gt; '', ])...

    boot-ragtime:使用Clojure Boot构建工具进行Ragtime迁移

    Ragtime提供了一种简洁的API来定义和执行数据库迁移,同时支持多种数据库引擎,如PostgreSQL、MySQL等。 **Boot-ragtime的用途** "boot-ragtime"是Boot的一个插件,专门设计用于集成Ragtime到Boot构建流程中。通过...

    演说者:演说者ORM提供了一个简单而美观的ActiveRecord实现

    ActiveRecord是数据库访问模式的一种,起源于Ruby on Rails框架,它允许开发者通过对象来操作数据库记录,使得代码更加面向对象,减少对SQL的直接依赖。 在Python ORM领域,虽然存在诸如SQLAlchemy这样的成熟库,但...

    golang-gorm:golang与gorm练习

    GORM是Golang的一个ORM库,它的目标是提供简单的API用于数据库操作,类似于Ruby on Rails的ActiveRecord。GORM支持多种数据库,如MySQL、PostgreSQL、SQLite和SQL Server,允许开发者通过面向对象的方式处理数据库...

Global site tag (gtag.js) - Google Analytics