I have downloaded and installed ActivePerl on my Windows 7-64 machine. Everything went smooth, and also loaded the perl
interpreter into my Eclipse
platform. However, when I try to access a localhost
MySQL database, I got the following error:
$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";
then I get the following error:
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.
Also, when I try to install DBD-Mysql I get:
C:\Perl64\bin>ppm install DBD-Mysql
ppm install failed: Can't find any package that provides DBD-Mysql
I have installed DBI
, Data-Table
, but I can't install DBD-Mysql
. Any thoughts? Thanks
See DBD-mysql ppm info page , build log file .
ActiveState tries to apply some local patches before building, but it fails. Contact them to have this fixed. Revert to 5.14 meanwhile for which a PPM package exists, or try to build DBD-mysql manually on your own system if you know how.
If your using a Linux machine you can install the package using and package manager. The package i believe is libdbd-mysql-perl
If that doesn't work you can console in to CPAN directly and install it using the command install DBD::mysql
This link has a bunch of different options you can try if what i mentioned above doesn't work
http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html
You need to install the DBD::mysql module. ActivePerl comes with the ppm utility to install modules.
ie, from the command line run this command: Quote
ppm install DBD::mysql
regards, samadhan
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.