DBI->连接不使用mysql驱动程序

时间:2016-12-02 02:49:12

标签: perl

我有以下代码

#!/usr/bin/perl -w
use  DBI;
use strict;
my $user = "test3";
my $password = "test3";
my $dsn = "dbi:mysql:hospital;localhost;3306";
my $dbh = DBI->connect($dsn, $user, $password);

我收到错误

Can't locate object method "driver" via package "DBD::mysql" at /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/DBI.pm line 821.

Perhaps the capitalisation of DBD 'mysql' isn't right. at /Users/hrai36/Documents/test2.pl line 9.

我对perl很新。我用cpan安装了DBD :: mysql。我不知道我做错了什么。

0 个答案:

没有答案