我已经在我的 Windows 7-64 机器上下载并安装了ActivePerl 。一切都很顺利,并且还将perl
解释器加载到我的Eclipse
平台中。但是,当我尝试访问localhost
MySQL 数据库时,出现以下错误:
$database = "<database>";
$host = "localhost";
$user = "<user>";
$password = "<password>";
#connect to MySQL database
my $db = DBI->connect(
"DBI:mysql:database=$db:host=$host",
$user,
$password
) or die "Can't Connect to database: $DBI::errstr\n";
然后我收到以下错误:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: C:/Users/souzamor/workspace/.metadata/.plugins/org.epic.debug C:/Users/souzamor/workspace/Parser C:/Perl64/site/lib C:/Perl64/lib .) at (eval 3) 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, Pg, Proxy, SQLite,
Sponge.
at C:/Users/souzamor/workspace/Parser/Parser.pl line 14.
此外,当我尝试安装 DBD-Mysql 时,我得到:
C:\Perl64\bin>ppm install DBD-Mysql
ppm install failed: Can't find any package that provides DBD-Mysql
我已经安装了DBI
,Data-Table
但是我无法安装DBD-Mysql
。有什么想法吗?谢谢