Thank you very much for your help!!! It works now!!!

There are two methods to fix the error mentioned by Derick.

1. Supply the socket path to mysql_connect() furnction.
e.g. $link = mysql_connect("localhost:3306:/var/lib/mysql/mysql.sock",
"user", "password");
where 3306 is default port and "/var/lib/mysql/mysql.sock" is socket path
supplied by me.
If the socket path is omitted, it is "/tmp/mysql.sock" by default. But there
is no such file in /tmp, so I use slocate command and find it in
/var/lib/mysql. This method is not recommended because you have to submit
the path every time.

2. Set "mysql.default_socket = /var/lib/mysql/mysql.sock" in php.ini and
restart Apache. But make sure the path of "mysql.sock" first. (Thanks Jesse
^_^)

"Jesse Scott" <[EMAIL PROTECTED]> ?????
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Make sure that your php.ini and your my.cnf both agree on where the socket
> file is going to be put.  And if you make any changes, be sure to restart
> both PHP/Apache and MySQL.  You might also check the logs and make sure
> that MySQL is actually launching, it might be encountering an error and
> quietly dieing as soon as you launch it.  I'm successfully running Apache
> 1.3.19, PHP 4.0.5, and MySQL 3.23.38.  When I upgraded from MySQL 3.23.32
I
> had that same warning come up, all it took was restarting mysqld and the
> warning went away.
>
> Hope you can get it figured out...
>
> -Jesse
>
> At 12:48 AM 5/21/01 +0800, rice wrote:
> >I have the same problem as you when using apache1.3.19, php4.0.5 and
> >mysql3.23.38 and get the same warning message. I've spent many time to
> >compile
> >the system again but failed. So I forgive to use the newest version and
use
> >apache1.3.17, php4.0.4 and mysql3.23.38. It works now!
> >
> >Hope someone can help!
> >
> >""Derick Dorner"" <[EMAIL PROTECTED]> ?????
> >00cd01c0e13e$a10cda90$9865fea9@moax01">news:00cd01c0e13e$a10cda90$9865fea9@moax01...
> >I receive the error when trying to connect to MySQL database:
> >
> >Warning: MySQL Connection Failed: Can't connect to local MySQL server
> >through socket '/tmp/mysql.sock' (111) in /usr/home/cupid/www/sql.php on
> >line 13
> >
> >The code I use to connect is:
> >$link = mysql_connect ("localhost", "username", "password");  file://with
> >the username and pw filled in obviously.
> >
> >Is this some type of config problem between MySQL and PHP or what? Any
help
> >is appreciated.
> >It ia a LAMP system BTW.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to