WARNING: You're using the Ruby-based MySQL library that ships with Rails.
Rails 作成したページにアクセスするとコンソールにMySQL libraryのワーニングが出力される件が解決した。
開発環境
ワーニングの内容
WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C-based MySQL library instead (gem install mysql).
C-based MySQL libraryをインストールしろということなのでインストールしてみるエラーになってしまう。
gem install mysql を実行するとエラー
MySQLライブラリを下記のコマンドでインストールしようとするとエラーになってしまう。
Kuru-MacBook:~ kuru$ gem install mysql Updating metadata for 46 gems from http://gems.rubyforge.org .............................................. complete Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install 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... yes 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... 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-mysql-config --without-mysql-config --with-mysql-dir --without-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 Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
この方法でインストールできた。
Kuru-MacBook:~ kuru$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config Building native extensions. This could take a while... Successfully installed mysql-2.7 1 gem installed
gem listで確認してみる
mysql (2.7)が追加されている。
Kuru-MacBook:~ kuru$ gem list *** LOCAL GEMS *** actionmailer (2.1.0, 1.3.6) actionpack (2.1.0, 1.13.6) actionwebservice (1.2.6) activerecord (2.1.0, 1.15.6) activeresource (2.1.0) activesupport (2.1.0, 1.4.4) acts_as_ferret (0.4.3, 0.4.1) amazon-ecs (0.5.3) capistrano (2.4.3, 2.0.0) cgi_multipart_eof_fix (2.5.0, 2.2) daemons (1.0.10, 1.0.9, 1.0.7) dnssd (0.6.0) fastthread (1.0.1, 1.0) fcgi (0.8.7) ferret (0.11.6, 0.11.4) gem_plugin (0.2.3, 0.2.2) highline (1.4.0, 1.2.9) hpricot (0.6) libxml-ruby (0.7.0, 0.3.8.4) mongrel (1.1.5, 1.1.4, 1.0.1) mysql (2.7) needle (1.3.0) net-sftp (2.0.1, 1.1.0) net-ssh (2.0.3, 1.1.2) rails (2.1.0, 1.2.6) rake (0.8.1, 0.7.3) RedCloth (3.0.4) ruby-openid (2.1.2, 1.1.4) ruby-yadis (0.3.4) rubynode (0.1.5, 0.1.3) sqlite3-ruby (1.2.2, 1.2.1) termios (0.9.4)
アプリケーションを実行してみる
アプリケーションを実行しページにアクセスしてみるとワーニングは出なくなった。
解決!!