CentOS4.4 MySQL5 DBD-MySQL(mysql.pm)のインストール
PerlからMySQLを操作できるようにするためにDBD-MySQLをインストールしたときの覚書。
CPANでインストールすれば簡単に設定できるらしいのですが、
今回の環境ではエラーが多発したので、手動でインストールします。
DBIのインストール
# yum install perl-DBI
共有ライブラリの設定
# vi /etc/ld.so.conf
最終行に追加
/usr/local/mysql/lib/mysql
設定の反映
# ldconfig
mysql_config にシンボリックリンクを張る
# ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
DBD::mysqlのインストール
# cd /usr/local/src
# wget http://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/authors/id/C/CA/CAPTTOFU/DBD-mysql-3.0004.tar.gz
# perl Makefile.PL
# make
# make install
発生したエラー
mysql_configが見つからない
# perl Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 466.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 466.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 466.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 466.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 466.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 466.
Failed to determine directory of mysql.h. Use
perl Makefile.PL --cflags=-I<dir>
to set this directory. For details see the INSTALL.html file,
section "C Compiler flags" or type
perl Makefile.PL --help
上記エラーを回避するために
# ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
を設定しました。
DBD-mysql-4.005.tar.gz (最新)をインストールするとエラーが多発して使えなかったので、DBD-mysql-3.0004.tar.gzを使いました。