这个问题主要提示是不能通过/tmp/mysqlsock连到服务器而php标准配置正是用过/tmp/mysqlsock但是一些mysql安装方法将mysqlsock放在/var/lib/mysqlsock或者其他的什么地方你可以通过修改/etc/f文件来修正它打开文件可以看到如下的东东
[mysqld]
socket=/var/lib/mysqlsock
改一下就好了但也会引起其他的问题如mysql程序连不上了再加一点
[mysql]
socket=/tmp/mysqlsock
或者还可以通过修改phpini中的配置来使php用其他的mysqlsock来连这个大家自己去找找
或者用这样的方法:
ln s /var/lib/mysql/mysqlsock /tmp/mysqlsock
还有:
phpmyadmin的说明书有说
The error message Warning: MySQL Connection Failed: Cant connect to local MySQL server through socket /tmp/mysqlsock () is displayed What can I do?
For RedHat users Harald Legner suggests this on the mailing list:
On my RedHatBox the socket of mysql is /var/lib/mysql/mysqlsock In your phpini you will find a line
mysqldefault_socket = /tmp/mysqlsock
change it to
mysqldefault_socket = /var/lib/mysql/mysqlsock
Then restart apache and it will work
Here is a fix suggested by Brad Ummer in the phpwizard forum:
First you need to determine what socket is being used by MySQL
To do this telnet to your server and go to the MySQL bin directory In this directory there should be a file named mysqladmin Type /mysqladmin variables and this should give you a bunch of info about your MySQL server including the socket (/tmp/mysqlsock for example)
Then you need to tell PHP to use this socket
Assuming you are using PHP or better you can specify the socket to use when you open the connection To do this in phpMyAdmin you need to complete the socket information in the configincphp
For example: $cfg[Servers][$i][socket] = /tmp/mysqlsock;