Bug#433506: libdbi-perl: connect() treats 'localhost' specially even if port number is given
Niko Tyni
ntyni at iki.fi
Sat Sep 15 19:28:41 UTC 2007
reassign 433506 libdbd-mysql-perl 3.0008-1
close 433506 4.004-1
thanks
On Tue, Jul 17, 2007 at 06:08:48PM +0200, Gabor Kiss wrote:
> Package: libdbi-perl
> Version: 1.53-1
> Severity: normal
> Error message:
> DBI connect('database=foo;host=localhost;port=3396','bar',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at <SCRIP_NAME_HERE> line 29
>
> If hostname is 'localhost' DBI tries to connect through a unix
> domain socket even of port number is given therefore obvious that
> a TCP connection is required.
> This may be a feature but MUST NOT be undocumented.
> '127.0.0.1', 'localhost.' or 'localhost.localdomain' works well.
Hi,
this is a feature of DBD::mysql, which implements the connect method for
MySQL data sources. The DBD::mysql manual in the Etch version (3.0008-1)
doesn't mention it, but this note was added soon afterwards:
The hostname, if not specified or specified as ’’ or ’localhost’,
will default to a MySQL server running on the local machine using the
default for the UNIX socket. To connect to a MySQL server on the local
machine via TCP, you must specify the loopback IP address (127.0.0.1)
as the host.
See also CPAN #23915:
http://rt.cpan.org/Public/Bug/Display.html?id=23915
As the feature is documented in Debian unstable, I'm closing this bug.
Please let me know if this isn't satisfactory.
Cheers,
--
Niko Tyni ntyni at iki.fi
More information about the pkg-perl-maintainers
mailing list