开始使用:cpan DBD::mysql 命令来安装该模块 由于是编译的版本的SQL版本,已经在/etc/profile 中修改:export PATH=/usr/local/mysql/bin:$PATH 担心找不到mysql lib文件。 报错如下: # Tried to use 'DBD::mysql'. # Error: Can't load '/root/.cpan/build/DBD-mysql-4.022/blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.16: 无法打开共享对象文件: 没有那个文件或目录 at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230. # at (eval 6) line 2 # Compilation failed in require at (eval 6) line 2. # BEGIN failed--compilation aborted at t/00base.t line 21. FAILED--Further testing stopped: Unable to load DBD::mysql make: *** [test_dynamic] 错误 9 /usr/bin/make test -- NOT OK Running make install make test had returned bad status, won't install without force [root@localhost dbdata_backup]# perl -MCPAN -e shell Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.7602) ReadLine support available (try 'install Bundle::CPAN') 解决方式: shell> perl -MCPAN -e shell cpan> install DBI cpan> install DBD::mysql 安装成功。 手工安装DBD安装技巧: 注意mysql的环境变量,若没有则用 添加/usr/local/mysql/bin到环境变量PATH中 PATH=/usr/local/mysql/bin:$PATH; export PATH (mysql的安装路径根据实际情况填写) wget http://cpan.perl.org/modules/by-module/DBI/DBI-1.601.tar.gz tar -zxvf DBD-mysql-4.006.tar.gz cd DBD-mysql-4.006 perl Makefile.PL –mysql_config=/usr/local/mysql/bin/mysql_config make make test make install (责任编辑:IT) |