There are two issues here:
- For MySQL, connecting to "localhost" means using a Unix socket (or a named
pipe in Windows). That's why you needed to set
$ENV{'MYSQL_UNIX_PORT'}. Instead of doing that, you could
have used either of these statements:
-
my $dbh=DBI->connect('dbi:mysql:dbname'
. ';host=127.0.0.1'
. ';port=3310',
'user', 'password');
-
my $dbh=DBI->connect('dbi:mysql:dbname'
. ';host=localhost'
. ';mysql_socket=/var/mysql4.1.9/mysql.sock',
'user', 'password');
- As for the client issue, with MySQL 4.1 there is a new communication
protocol to identify clients to the server. Also here, you have two
choices:
HTH