我有一个从 MySQL 数据库中检索数据的 Perl 脚本。这是代码:
sub startSession{
my $self = shift;
my $dsn = "dbi:".$self{platform}.":".$self{database}.":".$self{host}.":".$self{port};
print "$dsn\n" ;
$self{dbHandle} = DBI->connect($dsn,$user,$password);
}
我提供了来自外部文件的所有信息。我收到错误消息
DBI connect('dbname:**.**.**.**:3306','',...) failed: Access denied for user 'root'@'dbserver' (using password: NO) at line 89
Can't call method "prepare" on an undefined value at at line 97
我非常确定 root 可以从任何主机连接,并且密码也是正确的。