On Tue, Mar 20, 2001 at 03:12:39PM -0600, Jeff Jones wrote:
> I am using mysqld_multi to have several different mysql servers start. I have
> finally gotten it to work with php when I connect to a non-standard socket,
> such as /tmp/mysql.sock2. Does anyone know how to connect to a database with
> perl through that socket? I have tried the following with no luck:
>
> my($port) = '/tmp/mysql.sock2';
> my($mysql) = "DBI:mysql:webhost:localhost:$port";
> $dbh = DBI->connect($mysql, 'user', 'pass');
>
> But it will not establish the connection. Has anyone done this before or is
> it even possible with the Perl DBI?
Do a 'perldoc DBD::mysql' (or whatever the module name is on your system).
With version 1.2215 of the mSQL/MySQL modules on a FreeBSD system, this
is part of the documentation:
mysql_socket
As of MySQL 3.21.15, it is possible to choose
the Unix socket that is used for connecting to
the server. This is done, for example, with
mysql_socket=/dev/mysql
Usually there's no need for this option,
unless you are using another location for the
socket than that built into the client.
So, the following excerpt..
my $dbh = DBI->connect(
"DBI:mysql:database=test;host=localhost;mysql_socket=/tmp/mysql-alt.sock",
"root", "", 0);
..Works For Me (tm).
Hope that helps.
G'luck,
Peter
--
Hey, out there - is it *you* reading me, or is it someone else?
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php