Just a thought, if the defaults are not working and:
1.      you've verified you are trying to connect to the right server,
2.      you have network connectivity to the right server from the server where
the scripts are running,
3.      you have proper name resolution (since your script is trying to connect
by name and not by IP address),
4.      you have DBI, and DBD::MySQL all installed correctly,
5.      you have checked to make sure your MySQL daemon is running,
6.      have you run a "netstat -a" on the machine where the mysql daemon is
running to be sure it is listening on the default port?


There's not much more than that that can go wrong. If all of that is
checked, and you are trying to connect on the port where MySQL is listening,
you might be to the point of re-installing DBI, or DBD::MySQL...but check to
be sure all those parts are in place before resorting to a re-install.

Anyone know of anything I missed?

Steve Howard

-----Original Message-----
From: Juan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 8:10 PM
To: [EMAIL PROTECTED]
Subject: Connecting to MySQL


Hi,

I'm trying to connect MySQL using the following code:

#!/usr/bin/perl -w

use CGI qw(:standard);
use DBI();


print header;
print start_html("mysql");

print h1("Lista de Medicamentos/Cosméticos");


$dbh = DBI->connect("DBI:mysql:fol","fol","passfrr27");
$sth = $dbh->prepare("SELECT CODE,DESCRIPTION FROM PRODUCT LIMIT 0, 30");
$sth->execute or die "Error: ".$sth->errstr();

print p("=====================================");
print p("Number of records: $sth->rows");

while(($cod,$desc) = $sth->fetchrow_array) {
      print "$cod - $desc\n";
}

$dbh->disconnect;


print end_html;


PLEASE!!  What am I doing wrong???

TIA,
Juan.

Reply via email to