我已經在我的Windows 7-64機器上下載並安裝了ActivePerl。一切順利,並且還將perl
口譯員加載到我的Eclipse
平臺中。 然而,當我嘗試訪問localhost
MySQL數據庫,我得到了以下錯誤:問題在Windows中安裝perl DBI-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
。有什麼想法嗎? 謝謝
案例是很重要的。它是DBD-mysql,而不是DBD-Mysql。 –
@DaveCross我試過'DBD-mysql'和'DBD-Mysql'。我有相同的輸出。 – cybertextron