Railsで、DBを作成しようとしました。
以前の記憶からひらめいて、mysql-develをインストール。
$ rake db:create (in /home/user/railsapp) !!! 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
Rails 2.2.2でMySQL使うにはドライバを更新しないといけないみたいですよ・・ - てーげー探訪
Rails 2.2.2でMySQL使うにはドライバを更新しないといけないみたいですよ・・を参考に
# cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 ruby extconf.rb --with-mysql-config=/opt/local/bin/mysql_config5 extconf.rb:1: command not found: /opt/local/bin/mysql_config5 --cflags *** 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/local/bin/ruby --with-mysql-configダメでした。
以前の記憶からひらめいて、mysql-develをインストール。
# yum install mysql-devel Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: www.ftp.ne.jp * updates: www.ftp.ne.jp * addons: www.ftp.ne.jp * extras: www.ftp.ne.jp Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package mysql-devel.i386 0:5.0.45-7.el5 set to be updated ---> Package mysql-devel.x86_64 0:5.0.45-7.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: mysql-devel i386 5.0.45-7.el5 base 2.4 M mysql-devel x86_64 5.0.45-7.el5 base 2.4 M Transaction Summary ============================================================================= Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 4.8 M Is this ok [y/N]: y Downloading Packages: (1/2): mysql-devel-5.0.45 100% |=========================| 2.4 MB 00:04 (2/2): mysql-devel-5.0.45 100% |=========================| 2.4 MB 00:04 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: mysql-devel ######################### [1/2] Installing: mysql-devel ######################### [2/2] Installed: mysql-devel.i386 0:5.0.45-7.el5 mysql-devel.x86_64 0:5.0.45-7.el5 Complete!で、configurationオプションを参考に以下のように実行
#gem install mysql -- --with-mysql-config=/usr/bin/mysql_config Building native extensions. This could take a while... Successfully installed mysql-2.7 1 gem installedそして、再度、
$ rake db:create (in /home/user/railsapp)今度は、オッケーでした!!。