在 Windows 上,您应该执行以下操作来安装 MySQL DBD 模块: ActiveState Perl:On Windows, you should do the following to install the MySQL
DBD module with ActiveState Perl:
从 http://www.activestate.com/Products/ActivePerl/ 获取 ActiveState Perl 并安装它。Get ActiveState Perl from http://www.activestate.com/Products/ActivePerl/ and install it.
打开控制台窗口。Open a console window.
如有必要,请设置
HTTP_proxy变量。例如,您可以尝试如下设置:If necessary, set theHTTP_proxyvariable. For example, you might try a setting like this:C:\>
set HTTP_proxy=my.proxy.com:3128启动 PPM 程序:Start the PPM program:
C:\>
C:\perl\bin\ppm.pl如果您以前没有这样做过,请安装
DBI:If you have not previously done so, installDBI:ppm>
install DBI如果成功,请运行以下命令:If this succeeds, run the following command:
ppm>
install DBD-mysql
此过程应与 ActiveState Perl 5.6 或更高版本一起使用。This procedure should work with ActiveState Perl 5.6 or higher.
如果您无法使该过程工作,则应安装 ODBC 驱动程序并连接到 MySQL 通过 ODBC 连接服务器:If you cannot get the procedure to work, you should install the ODBC driver instead and connect to the MySQL server through ODBC:
use DBI;
$dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) ||
die "Got error $DBI::errstr when connecting to $dsn\n";