THow to solve the problem .Tried many times and ways to fixed @.@

bobpang425

Verified User
Joined
Dec 4, 2006
Messages
8
Server : centos 4.4
Mysql : 4.1

Discuz! info: Can not connect to MySQL server

Time: 2006-12-2 6:26pm
Script: /index.php

Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11)
Errno.: 2002

i have tried out find the solutions but ....end until now......have the problem.
anyone can help me ?
1. change the /var/lib/mysql/ premission can' t!!!
2. ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
also can't @.@
3. cp /usr/share/mysql/my-medium.cnf /etc/my.cnf to /etc/my.cnf also can't ..
.........help please!!Thanks !!!!
 
Last edited:
bobpang425 said:
Server : centos 4.4
Mysql : 4.1

Discuz! info: Can not connect to MySQL server

Time: 2006-12-2 6:26pm
Script: /index.php

Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11)
Errno.: 2002

i have tried out find the solutions but ....end until now......have the problem.
anyone can help me ?
1. change the /var/lib/mysql/ premission can' t!!!
2. ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
also can't @.@
3. cp /usr/share/mysql/my-medium.cnf /etc/my.cnf to /etc/my.cnf also can't ..
.........help please!!Thanks !!!!

If your application is looking for your mysql.sock in /var/lib/mysql/mysql.sock and it really exists in /tmp then your command in #2 is wrong. That says make the file /tmp/mysql.sock point to /var/lib/mysql/mysql.sock, you would want it the other way around.

The /etc/my.cnf configures where mysql will put that socket file, but that also requires a restart of mysql. As far as php is concerned, it tries to figure out where the mysql.sock file is located at compile time, if you changed the location after you compiled php, you can either change your /etc/my.cnf to match what php is looking for or recompile php and perhaps even use the --with-mysql-sock switch to insure where it will look for that file.
 
Back
Top