rails ubuntu环境下mysql适配器安装

本机环境:ubuntu9.10  ruby1.87  rails 2.2.2  mysql 5.1        


       step 1:
          从http://www.tmtm.org/en/mysql/ruby/下载 mysql-ruby-2.X.tar.gz
     
      
step 2:
           解压后,cd 到当前目录,运行 : ruby extconf.rb
           如果报错:
          
no such file to load -- mkmf (LoadError)
           from extconf.rb:1
           则运行 :sudo apt-get install ruby1.8-dev

      
step 3:
          
运行 :  ruby extconf.rb --with-mysql-dir=/usr/share/mysql(注:你本机mysql安装目录)
           如果报错:
          
-----------------------------------------------------------------------------------------------------
           checking for mysql_query() in -lmysqlclient... no
           checking for main() in -lm... yes
           checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.8
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib

-----------------------------------------------------------------------------------------------------

则运行 : sudo apt-get install libmysqlclient15-dev

step 4 :
      运行 : make

step 5 :
     运行 : make install


ps:上次用django开发,mysql这块也是配置了半天。哎,难怪用j2ee的人这么多,入门没这么烦。

posted @ 2011-08-09 14:01  海鸟  阅读(473)  评论(0编辑  收藏  举报