perl环境下安装mysql的数据库驱动的问题
我已经安装了ActivePerl-5.10.0.1003-MSWin32-x86-285500.msi,然后安装驱动mysql-connector-odbc-5.1.5-...
我已经安装了ActivePerl-5.10.0.1003-MSWin32-x86-285500.msi,然后安装驱动mysql-connector-odbc-5.1.5-win32.rar后,报错,大家看下出错在哪里。
-- Opening UDP listen socket on port 27500 ... opened OK
-- Connecting to MySQL database 'hlstats' on '127.0.0.1:3306' as user 'root' ...
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
C:/Perl/site/lib C:/Perl/lib .) at (eval 7) 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.
at D:\xinpaihangwenjian\hlstats.pl line 984 展开
-- Opening UDP listen socket on port 27500 ... opened OK
-- Connecting to MySQL database 'hlstats' on '127.0.0.1:3306' as user 'root' ...
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
C:/Perl/site/lib C:/Perl/lib .) at (eval 7) 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.
at D:\xinpaihangwenjian\hlstats.pl line 984 展开
3个回答
展开全部
需要安装 DBD::mysql 模块,你的系统中现在没有,因此无法连接到MYSQL数据库
安装方法是(在CMD方式下执行命令):
ppm install DBD::mysql
或
perl -MCPAN -e "install DBD::mysql"
后面的命令需要你的电脑有C语言编译器
安装方法是(在CMD方式下执行命令):
ppm install DBD::mysql
或
perl -MCPAN -e "install DBD::mysql"
后面的命令需要你的电脑有C语言编译器
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
直接给代码哈。
use DBI;
my $DATABASE = DBI->connect("DBI:mysql:dbOffice:localhost",'(Username)','(Password)',{RaiseError=>1}) || "Database connection failure: $DBI::errstr";
if($DBI::err){
print "Content-type: text/html\n\n";
print "Database Connect Error...<br>($DBI::err) $DBI::errstr";
exit;
}
这是已测代码
use DBI;
my $DATABASE = DBI->connect("DBI:mysql:dbOffice:localhost",'(Username)','(Password)',{RaiseError=>1}) || "Database connection failure: $DBI::errstr";
if($DBI::err){
print "Content-type: text/html\n\n";
print "Database Connect Error...<br>($DBI::err) $DBI::errstr";
exit;
}
这是已测代码
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询