
photores
Deleted
Mar 26, 2001, 6:08 AM
Post #1 of 4
(961 views)
|
|
DBI can not connect to Mysql
|
Can't Post
|
|
Hi, guys! Please, help. I write script that use DBI for connecting to Mysql, but I have error: - "DBI->connect(mail_list:localhost:3306) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) at /var/www/cgi-bin/test.pl line 15 Can't call method "prepare" on an undefined value at /var/www/cgi-bin/test.pl line 17. "- I try change users access e.t.c., but without results. Please HELP! :-) ########################################### #!/usr/bin/perl ################################ use CGI qw(:standard); use DBI; use Parse; my $tpl = new Parse; use strict; my $db = param('db'); my $query = param('query'); print "Content-type: text/html\n\n"; if($query) { my $dbh = DBI->connect("DBI:mysql:$db:localhost:3306"); my $dbs = $dbh->prepare($query); $dbs->execute; my $err = $dbh->errstr; if($err) { $tpl->{'ERROR'} = "А вот и ошибочка случилась: $err"; $tpl->{'DB'} = $db; } } File is attached.
(This post was edited by photores on Mar 26, 2001, 5:16 AM)
|