If you want to write Perl scripts that can access the MySQL database, you need to install the DBI module. You need to install two groups of DBI modules, one of which is the DBI module that provides various basic DBI drivers, another group is the DBD: MySQL module that provides various mysql-specific drivers. If you want to write some Web-based DBI scripts, You have to install CGI. pm module, you can use the perldoc command to check whether a Perl module has been installed. If this module has been installed, the perldoc command will display the documentation of this module, as shown below:
% Perldoc DBI
% Perldoc DBD: mysql
% Perldoc CGI
If you want to install the Perl module on Linux, the simplest way is to use CPAN shell, log on as root, and then issue the following command:
# Perl-MCPAN-e shell
Cpan> install DBI
Cpan> install DBD: mysql
Cpan> install CGI
You can also download the source code release version in the form of tar compressed files from the cpan.perl.org site. After decompression, switch to the corresponding file directory.
Cd DBI-1.54
Perl Makefile. PL
Make
Make test
Make install
During installation, an error occurs during 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 .)
Description Time/Hires. pm cannot be found, to http://www.perl.com/CPAN/modules/by-module/Time/
After the download site, through the above method after installation, and then re-install the DBI-1.54 just fine, and then continue to install DBD: mysql
Cd/root/DBD-mysql-4.001
Perl Makefile. PL
Make
Make test
Make install
The mysql_config file is not found when an error is reported during installation.
Ln-s/usr/local/mysql/bin/mysql_config/sbin/mysql_config
After the link is established, the perl Makefile. PL problem is solved.