Cannot connect to an MySQL database using Named Pipes



Hi Folks,

I have a database running on Window XP, that I want to disable network connections to and enable 'named pipes'. I am running MySQL 5.0.27 and my.ini looks like...

[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

[mysqld]
#port = 3306
socket = /tmp/mysql.sock
#Allow connections via named pipes (Windows NT+ only). Note: you can specify a pipe name on the advanced network page, if required.
enable-named-pipe
#Don't allow connections via TCP/IP.
skip-networking



I can connect to the DB using the MySQL GUI tools if I set my pipe name to '/tmp/mysql.sock' using the login dialog box.
However when I try and connect using PHP I get an error. I have tried several variants of the connect command and I get various errors but all are along the lines of:
Unknown MySQL server host '/tmp/mysql.sock' (11004) or
Can't connect to MySQL server on 'localhost' (10061)

I have tried
$mysqli = new mysqli(null, $username,$password, $database);
$mysqli = new mysqli("localhost:/tmp/mysql.sock", $username,$password, $database);
$mysqli = new mysqli("localhost", $username,$password, $database,3306,"/tmp/mysql.sock");
$mysqli = new mysqli("localhost", $username,$password, $database,"/tmp/mysql.sock");
$mysqli = new mysqli("/tmp/mysql.sock", $username,$password, $database);

I have also tried the above commands using mysqli_connect ? I have done a few searches of the web but seem to always come up with something like the above? Anybody have any ideas why it won't connect in PHP ?

TIA,
JC
.



Relevant Pages

  • Re: Experiences with mysql_pconnect?
    ... talk to a MySQL 5.0.45 DB on an Apache 1.3 series server. ... dangling connections to the server at the php.net site. ... especially when the server is remote as it requires multiple calls to MySQL. ... queries that you execute on a regular basis, preparing it and then ...
    (comp.lang.php)
  • Re: Experiences with mysql_pconnect?
    ... talk to a MySQL 5.0.45 DB on an Apache 1.3 series server. ... dangling connections to the server at the php.net site. ... > Using prepared statements will probably speed up your app a lot. ... especially when the server is remote as it requires multiple calls to MySQL. ...
    (comp.lang.php)
  • Re: Reducing load for LAMP app?
    ... MySQL: as much as possible, he keeps query results in RAM, but ... His hoster says that Apache server is under significant load. ... Using apc is pretty much transparent, but memcached will require modifying your database abstraction layer using the memcached functions. ... With persistent connections, you must have the maximum number of connections *ever* required allocated *all of the time* - even if no one is using your server. ...
    (comp.lang.php)
  • Re: [PHP-DEV] [PHP4] Logging native PHP function calls
    ... X (number of mysql usernames) ... If you really have 150 MaxClients in httpd.conf and 140 mysql ... 15,600 mysql connections is a LOT of connections, and will take a LOT ... I've never tried to run a server with 140 mysql usernames, ...
    (php.general)
  • Re: Reducing load for LAMP app?
    ... MySQL: as much as possible, he keeps query results in RAM, but ... His hoster says that Apache server is under significant load. ... Using apc is pretty much transparent, but memcached will require modifying your database abstraction layer using the memcached functions. ... With persistent connections, you must have the maximum number of connections *ever* required allocated *all of the time* - even if no one is using your server. ...
    (comp.lang.php)