I have the following piece of code:
<?
$host = "localhost";
$user = "webrings";
$password = "XXX";
$link = MYSQL_CONNECT($host,$user,$password);
if ($link == 0) {
echo "Can't connect to MySQL.";
exit;
} else {
echo "Connection established.";
exit;
}
?>
And when I load that up through the web, it tells me:
Warning: MySQL Connection Failed: Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (111)
Can't connect to MySQL.
However, MySQL is NOT using /tmp/mysql.sock at all. That file is in
/var/mysql/mysql.sock. Now, I can manually connect to the server just
fine from the command prompt:
$ mysql -h localhost -u webrings -p webring
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 236 to server version: 3.23.36-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer
mysql>
So I know the server is working, yet it returns error 111
(connection refused). Okay, so I move that piece of code to a remote
machine and add the necessary privileges to mysql (and flush them), make
the change to the $host variable and try it. And it connects! No
problem.
What am I overlooking? I just checked my.cnf, and it has
/var/mysql/mysql.sock defined in both [client] as well as [mysqld]... I
know mysql has been restarted (several times in fact)...
--
H | Hi, I'm currently out of my mind. Please leave a message. BEEEEP!
|____________________________________________________________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . eFax 248.671.0909
http://www.pcraft.com . 3550 Arapahoe Ave, #6
.................. . . . . Boulder, CO 80303, U.S.A.
---------------------------------------------------------------------
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