|
|
|
|
Snort Forums Archive
Archive Home » General Chat » Can't connect '/var/lib/mysql/mysql.sock' (13) – but not the usual suspects???
Please note that the categories listed below represent an archived version of our forums pages. To view the current version and be able to post and reply to threads, please register and login here to go to the full forums pages.
[ Notice: Full Version of This Topic ]
Can't connect '/var/lib/mysql/mysql.sock' (13) – but not the usual suspects???
Posted by Seanie on July 15, 2007 05:50:47
Hello All
I'm new to Linux and am trying to learn to develop PHP and MySQL web applications but
am stuck.
I'm running Suse 10.0 and have installed Apache, PHP and MySQL from the DVD.
Apache, and PHP are working and produces the expected output.
MySQL is also working and I've used knoda to create a sample database.
I'm using this php to try to connect to MySQL
Test PHP with MySQL
Databases in the local MySQL server\n";
echo "";
while ($row = mysql_fetch_row($result)) {
echo " $row[0]\n";
}
echo " ";
?>
However, when I try it I get:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) .
I've been searching the posts and understand that 13 means it is a permissions problem.
However all the reported causes I can find seem OK on my machine.
1) MySQL is running
I've checked with mysqladmin ping and get the following
linux:~ # mysqladmin -p ping
Enter password:
mysqld is alive
linux:~ #
2) SELinux is disabled
I used usr/sbin/setenforce Permissive and now /usr/sbin/getenforce says 'Disabled'
linux:~ #
3) mysql.sock is where I'd expect it to be with the expected mysql owner, mysql group and
expected permissions. I tested this like so.
linux:~ # ls -l /var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 Jul 15 13:54 /var/lib/mysql/mysql.sock
linux:~ #
4) /var/lib/mysql/ has the expected mysql owner, mysql group and expected permissions.
I tested this like so.
linux:~ # ls -l /var/lib/
......(omitting lines here)
drwxrwxrwx 7 mysql mysql 520 Jul 15 13:54 mysql
......(omitting lines here)
linux:~ #
6) I included myself in the mysql group.
Clearly, I am missing something but I don't know what.
My guess is it is something silly and simple, but it beats me. Any help anyone can give
would be greatly appreciated. |
|
Posted by Seanie on July 15, 2007 05:54:35
Sorry, the PHP section is garbled. Hope this works better
$mysqluser = 'root';
$mysqlpasswd = 'mypassword123';
$mysqlhost = 'localhost';
$connID = mysql_connect($mysqlhost, $mysqluser, $mysqlpasswd);
$result = mysql_list_dbs();
echo "Databases in the local MySQL server \n";
echo "";
while ($row = mysql_fetch_row($result)) {
echo " $row[0]\n";
}
echo " "; |
|
|
|
|
|