Install Perl DBI support on Linux

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.