The problem is the way that the driver defaults. Locally you can connect using either UNIX or TCP sockets. For localhost the default is UNIX sockets (faster). At compile time the location of the default mysql UNIX socket is effectively compiled in so your driver is loosly coupled to the original MySQL 4.0.x
The fix is easy - add the hostname to force use of TCP sockets, or tell the driver where the 4.1.x socket is. Any of these should work:
$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; $dsn = "DBI:mysql:test;mysql_read_default_file=/home/foo/my.cnf"; $dsn = "DBI:mysql:test;mysql_socket=/dev/mysql"; $dbh = DBI->connect($dsn, $user, $password, {'RaiseError' => 1} );
cheers
tachyon
In reply to Re: DBD MySQL connect problem.
by tachyon
in thread DBD MySQL connect problem.
by shemp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |