- 论坛徽章:
- 0
|
连接数据库出错:Mysql connect('database=recovery;host=localhost','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at ./domain194.pl line 15
Can't call method "query" on an undefined value at ./domain194.pl line 24, <IN> line 1.
#!/usr/bin/perl
$db_host = "localhost";
$db_user = "root";
$db_passwd = "XXXXX";
$db_name = "recovery";
#$records_name=<STDIN>;
$file2 = 'listlist194';
open (SIN,"< $file2") or die "Cant not open $file2 for reading; $!";
while (my $sin1 = <SIN>){
$file = "$sin1";
########################################
use Mysql;
$dbh = Mysql->connect("$db_host","$db_name","$db_user","$db_passwd");
请问高手是什么原因? |
|