2015年11月29日
gemでのmysql のインストールエラー+接続エラーメモ
rubyからmysqlを操作するプログラムを書く必要があり、
CentOSで、bundle installを使用したところ、下記エラーが発生。
下記の方のエントリーを参考に、yum でmysql-develをインストトール
http://sweep3092.hatenablog.com/entry/2014/12/11/163108
その後、改めて、bundle install を実施し、無事成功。
次に接続のプログラムを実行したところ、下記のエラーに遭遇。
下記を参考に、ホスト名に「localhost」と指定したところ、
「127.0.0.1」に修正し、無事成功。
http://q.hatena.ne.jp/1273032729
CentOSで、bundle installを使用したところ、下記エラーが発生。
# ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [i686-linux]
#
#
# gem install mysql
Fetching: mysql-2.9.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** 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
--without-mysql-config
/usr/local/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:531:in `try_link'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:717:in `try_func'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:1001:in `block in have_func'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:892:in `block in checking_for'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:307:in `open'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpone'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:307:in `open'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:1000:in `have_func'
from extconf.rb:45:in `'
Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
#
ruby 2.0.0p195 (2013-05-14 revision 40734) [i686-linux]
#
#
# gem install mysql
Fetching: mysql-2.9.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** 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
--without-mysql-config
/usr/local/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:531:in `try_link'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:717:in `try_func'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:1001:in `block in have_func'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:892:in `block in checking_for'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:307:in `open'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpone'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:307:in `open'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
from /usr/local/lib/ruby/2.0.0/mkmf.rb:1000:in `have_func'
from extconf.rb:45:in `
Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
#
下記の方のエントリーを参考に、yum でmysql-develをインストトール
http://sweep3092.hatenablog.com/entry/2014/12/11/163108
# yum install mysql-devel
その後、改めて、bundle install を実施し、無事成功。
# gem install mysql
Building native extensions. This could take a while...
Successfully installed mysql-2.9.1
Parsing documentation for mysql-2.9.1
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for lib/mysql/mysql_api.so, skipping
Installing ri documentation for mysql-2.9.1
1 gem installed
#
Building native extensions. This could take a while...
Successfully installed mysql-2.9.1
Parsing documentation for mysql-2.9.1
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for lib/mysql/mysql_api.so, skipping
Installing ri documentation for mysql-2.9.1
1 gem installed
#
次に接続のプログラムを実行したところ、下記のエラーに遭遇。
#ruby db_reg.
rbdb_reg.rb:5:in `new': Unknown MySQL server host 'localhost;mysql_socket=/tmp/mysql.sock' (1) (Mysql::Error)
from db_reg.rb:5:in `'
#
rbdb_reg.rb:5:in `new': Unknown MySQL server host 'localhost;mysql_socket=/tmp/mysql.sock' (1) (Mysql::Error)
from db_reg.rb:5:in `
#
下記を参考に、ホスト名に「localhost」と指定したところ、
「127.0.0.1」に修正し、無事成功。
http://q.hatena.ne.jp/1273032729
【このカテゴリーの最新記事】
-
no image
-
no image
-
no image
-
no image
-
no image
この記事へのコメント
コメントを書く
この記事へのトラックバックURL
https://fanblogs.jp/tb/4466812
※ブログオーナーが承認したトラックバックのみ表示されます。
この記事へのトラックバック