Perl连接MySQL需要安装Perl的DBI和DBD:mysql模块。 记录一下连接MySQL的脚本,供以后参考: #!/bin/env perl use strict; use warnings; use DBI; # ------------------------------------------------------------------- # Func : Main() # ------------------------------------------------------------------- my $user = "root"; my $passwd = ""; my $host = "10.254.5.151"; my $db = "test"; my $port = 3306; # connect database my $dbh = &connet_mysql($host,$port,$db,$user,$passwd);