Install bitsCN.com on the DBI and DBD-mysql modules
Install the DBI and DBD-mysql modules
I. DBI installation
Wget http://www.cpan.org/modules/by-module/DBD/DBI-1.604.tar.gz
Tar-zxvf DBI-1.604.tar.gz
Cd DBI-1.604
Perl Makefile. PL
Make
Make test
Make install
II. DBD installation
Yum-y intall mysql-devel
Note the mysql environment variables. if not, add/usr/binl/mysql to the environment variable PATH.
PATH/usr/binl/mysql: $ PATH;
Export PATH (mysql installation PATH is set based on actual conditions)
Wget http://www.cpan.org/modules/by-module/DBD/DBD-mysql-4.006.tar.gz
Tar-zxvf DBD-mysql-4.006.tar.gz
Cd DBD-mysql-4.006
Perl Makefile. PL -- mysql_config =/usr/bin/mysql_config
Make
Make test
Make install
Test connection:
#! /Usr/bin/perl
Use DBI;
$ User = "test ";
$ Passwd = "test ";
$ Dbh = "";
$ Dbh = DBI-> connect ("dbi: mysql: database = test; host = 192.1.1.168; port = 3306", $ user, $ passwd) or die "can't connect
Database ". DBI-errstr;
$ Something = $ dbh-> prepare ("select * from infobright_loaddata_status ");
$ Something-> execute;
While (@ recs = $ Something-> fetchrow_array ){
Print $ recs [0]. ":". $ recs [1]. ":". $ recs [2]. "/n ";
}
$ Dbh-> disconnect;
BitsCN.com