Quote:
Originally Posted by dla-nor
Do you have the php-mysql package installed? That's the first thing I would check. What's the complete listing of php and mysql related packages you have installed?
|
Thanks for your response. I am a newbie and I don't know where to find the php-mysql package.
Additional info
---------------
<?php
$mysqli = mysqli_connect('localhost', 'mysql', 'password', 'testDB');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
?>
Error Message:
Connect failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
---------------
I ran the phpinfo() function from a script and found the following listed under the mysql section
MYSQL_SOCKET /var/lib/mysql/mysql.sock
but there is no /var/lib/mysql directory on the system
when I typed:
ps xa | grep mysqld
I get:
---------------------------------------------------
1900 ? S 0:00 /bin/sh ./bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.localdomain.pid
2005 ? Sl 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --log-error=/usr/local/mysql/data/localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid --socket=/tmp/mysql.sock --port=3306
3450 pts/0 S+ 0:00 grep mysqld
-----------------------------------------------------
I found:
--socket=/tmp/mysql.sock in the output
ls -l /tmp/mysql.sock
srwxrwxrwx 1 mysql mysql 0 2008-02-22 22:23 /tmp/mysql.sock
I also found this line in /etc/my.cnf
socket = /tmp/mysql.sock
I don't know why the phpinfo() function show
MYSQL_SOCKET /var/lib/mysql/mysql.sock
I don't know where to go from here
Thanks