简体   繁体   English

在Windows中安装perl DBI-mysql的问题

[英]issues installing perl DBI-mysql in windows

I have downloaded and installed ActivePerl on my Windows 7-64 machine. 我已经在Windows 7-64机器上下载并安装了ActivePerl Everything went smooth, and also loaded the perl interpreter into my Eclipse platform. 一切顺利,并且还将perl解释器加载到我的Eclipse平台中。 However, when I try to access a localhost MySQL database, I got the following error: 但是,当我尝试访问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";

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: 此外,当我尝试安装DBD-Mysql时,我得到:

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 . 我已经安装了DBIData-Table ,但我无法安装DBD-Mysql Any thoughts? 有什么想法吗? Thanks 谢谢

See DBD-mysql ppm info page , build log file . 请参阅DBD-mysql ppm信息页面构建日志文件

ActiveState tries to apply some local patches before building, but it fails. ActiveState尝试在构建之前应用一些本地补丁,但它失败了。 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. 同时恢复到5.14,其中存在PPM包,或者如果您知道如何,则尝试在您自己的系统上手动构建DBD-mysql。

If your using a Linux machine you can install the package using and package manager. 如果您使用的是Linux机器,则可以使用和包管理器安装软件包。 The package i believe is libdbd-mysql-perl 我相信的包是libdbd-mysql-perl

If that doesn't work you can console in to CPAN directly and install it using the command install DBD::mysql 如果这不起作用,您可以直接控制到CPAN并使用命令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 http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html

You need to install the DBD::mysql module. 您需要安装DBD :: mysql模块。 ActivePerl comes with the ppm utility to install modules. ActivePerl附带ppm实用程序来安装模块。

ie, from the command line run this command: Quote 即,从命令行运行此命令:Quote
ppm install DBD::mysql ppm安装DBD :: mysql

regards, samadhan 问候,samadhan

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM