安装时请注意顺序:
1.安装mysql 并运行
2.首先安装DBI :
Perl MakeFile.PL
Make
Make install
3.DBD-mysql包
#perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config (指定mysql_config位置)
或者:
#perl Makefile.PL -mysql_config=/home/mysql/bin/mysql_config -testuser=root -testpassword=dbadmin
#make
#make test //检测安装是否成功,如果在此处有错误提示,则需要做后面的cp 文件的动作
#make install
install_driver(mysql) failed: Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.12: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.
at (eval 6) line 3
Compilation failed in require at (eval 6) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /root/mysqlreport line 162
cp文件的动作:
#cp /usr/local/mysql40/include/mysql/* /usr/include/ #cp /usr/local/mysql40/lib/mysql/* /usr/lib/ |
测试:
首先在test库中创建一个table:
如果能够正确的显示出testuser 那表示安装成功。
然后执行下面的Perl脚本插入一条数据并且查询得到结果:
然后再重新安装DBD: DBD-mysql-4.005
#make clean #perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config |