Re: [PHP] Cannot connect to an MySQL database using Named Pipes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



try run winmysqladmin.exe
is there a posibility your mysql server got crash with unknown reason
----- Original Message -----
From: "John Comerford" <johnc@xxxxxxxxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Wednesday, May 16, 2007 11:05 AM
Subject:  [PHP] Cannot connect to an MySQL database using Named
Pipes


> Hi Folks,
>
> I have a MySQL database running on Windows 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);
<?
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    //exit();
}

printf("Host information: %s\n", $mysqli->host_info);

/* close connection */
$mysqli->close();
?>

can u try above.. I got bad felling bout this??

>
> 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
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux