在Linux系统上安装Perl DBI支持
Jun 07, 2016 pm 04:52 PM如果你想编写一些能够访问MySQL数据库的Perl脚本,就需要安装DBI模块,需要安装两组DBI模块,一组是负责提供各种DBI基本驱动程序
如果你想编写一些能够访问MySQL数据库的Perl脚本,就需要安装DBI模块,需要安装两组DBI模块,一组是负责提供各种DBI基本驱动程序的 DBI模块,另一组是负责提供各种MySQL专用驱动程序的DBD::mysql模块,如果你还想编写一些基于Web的DBI脚本,那就还得安装 CGI.pm模块,可以利用perldoc命令来查知某个Perl模块是否已经安装好了,如果已经安装了该模块,perldoc命令就会把该模块的文档显示出来,如下所示:
%perldoc DBI
%perldoc DBD::mysql
%perldoc CGI
如果想把Perl模块安装到Linux系统上,最简单的办法就是使用CPAN shell,以root身份登陆,然后发出如下命令:
#perl -MCPAN -e shell
cpan>install DBI
cpan>install DBD::mysql
cpan>install CGI
还可以从cpan.perl.org站点下载tar压缩文件形式的源代码发行版本,解压缩后,切换到相应的文件目录
cd DBI-1.54
perl Makefile.PL
make
make test
make install
安装过程中,在make test时出现错误
t/zvxgp_85gofer...........Can't locate Time/HiRes.pm in @INC (@INC contains: /root/DBI-1.54/blib/lib/5.8.5/i386-linux-thread-multi /root/DBI-1.54/blib/lib/5.8.5。)
说明无法找到Time/Hires.pm,到
网站下载后,通过上面的方法安装后,再重新安装DBI-1.54就好了,然后继续安装DBD::mysql
cd /root/DBD-mysql-4.001
perl Makefile.PL
make
make test
make install
安装过程中报错没有找到mysql_config文件
ln -s /usr/local/mysql/bin/mysql_config /sbin/mysql_config
做了链接后再perl Makefile.PL问题解决。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Develop efficient web crawlers and data scraping tools using Vue.js and Perl languages

Best practices for building high-performance web applications using Python and Perl

Develop system scripts and automation tools using Vue.js and Perl languages

How to use Nginx as a Perl program server and its Perl module under Linux

Redis and Perl language development: building efficient command line tools

How to develop distributed file synchronization function using Redis and Perl 6

How to develop a simple key-value storage function using Redis and Perl
