Hatena::ブログ(Diary)

適当探訪

2008-12-07

Rails 2.2.2でMySQL使うにはドライバを更新しないといけないみたいですよ・・

今度はmigrationで落ちた!

# rake db:migrate
(in /Users/sogo/rails/hellorails)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql

お前のドライバは2.2では外されたとかゆうてますよ・・

# cd /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7
# sudo ruby extconf.rb --with-mysql-config=/opt/local/bin/mysql_config5 
checking for mysql_ssl_set()... yes
checking for mysql.h... yes
creating Makefile
# sudo make
/usr/bin/gcc-4.0 -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin9.2.2 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/opt/local/include -I/opt/local/include/mysql5/mysql -fno-common -O2  -fno-common -pipe -fno-common  -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o mysql.bundle mysql.o -L"." -L"/opt/local/lib" -L. -L/opt/local/lib    -lruby -L/opt/local/lib -L/opt/local/lib/mysql5/mysql -lmysqlclient -L/opt/local/lib -lz -lm  -L/opt/local/lib -lssl -lcrypto  -lpthread -ldl -lobjc  
# sudo make install
/usr/bin/install -m 0755 mysql.bundle /opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.2

これで動きました。これがRails 2.2の洗礼か・・

# cd ~/rails/hellorails                         
# rake db:migrate                               
(in /Users/sogo/rails/hellorails)
==  CreateUsers: migrating ====================================================
-- create_table(:users)
   -> 0.0041s
==  CreateUsers: migrated (0.0044s) ===========================================

参考

Macでgem install mysqlをする方法

スパム対策のためのダミーです。もし見えても何も入力しないでください
ゲスト


画像認証

Connection: close