Perl中连接MySQL问题
请问高手, Perl 连接MySQL时,语句如下:
use DBI;
my $dbh = DBI->connect("dbi:mysql:testsql:localhost,port=3306","root","abc");
print "success";
$dbh->disconnect;
但是在编译时会遇到如下错误提示:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
D:/Program Files/Perl/site/lib D:/Program Files/Perl/lib .) at (eval 5) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: CSV, DBM, ExampleP, File, Gofer, ODBC, Oracle, Proxy, SQLite,
Sponge, mysqlPP.
at F:\Perl\data.pl line 2
安装错误提示方法在Active Perl的包管理中安装DBI,DBD模块并更新,仍然不行,是什么原因呢
[解决办法]
安装DBD::mysql了?
[解决办法]
应该是没安装DBD:mysql模块的缘故。
DBI模块连接数据库需要数据库驱动,一般是以DBD::开头的相应模块。