• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

[MySQL] How to create a .sock file?

#1
I got an Apache2/php4/MySQL4.0 installation running on my Slackware Linux box. All is installed fine, but I got one little issue. PHP refuses to connect to MySQL, this error occurs:
Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
I peeked into /var/run/mysql/ and the file isn't there, only mysql.pid.
I have checked the rights for that dir, they are 755 for user mysql and group mysql, so it should be able to wrote to that dir upon startup. How can I fix this problem?
 

X-Istence

*
Political User
#2
Check /tmp for a mysql.sock

Then check your php.ini and point it at the right location.

It should also contain an option to disable sock operations, and instead just connect on a certain port, for this, also check PHP.ini.

You could always if it is in /tmp:

cd /var/run/mysql/
ln -s /tmp/mysql.sock

And be done with it. Butthat is up to you.

X-Istence
 

j79zlr

Glaanies script monkey
Political User
#5
try it ;)

<<edit>>

Hmmm mysql restarted without the my.cnf file, I would swear it wouldn't, I know it wouldn't used to.
 
#6
I did have a my.cnf file in my /etc dir, so that wasn't the case. I set the mysql.default.socket option to /tmp/mysql.sock and all was good again. I was used to FreeBSD porting system, where all the options are set correctly, guess compiling from source takes a bit more configuring. Anyway, another thing learnt, it's getting more fun!
 

X-Istence

*
Political User
#7
j79zlr said:
try it ;)

<<edit>>

Hmmm mysql restarted without the my.cnf file, I would swear it wouldn't, I know it wouldn't used to.
You swear it would not? It does on my 3.x install which is running on BSD. Same thing with the new 4.1 and the bit older 4.0.

See i knew this for one reason only, because the FreeBSD ports tree does not add a standard my.cnf anywhere, so there is nothing to read from. This means it has to somehow do it from some standard it has either compiled in at compile time, or because it was hard coded in the code.
 

j79zlr

Glaanies script monkey
Political User
#8
Yea, but I remember sepcifically having that promlem where it couldn't create the socket file until I copied one of the my.cnf default files into /usr/local/etc/. This was with MySQL 3.x years ago.

MySQL installs example my.cnf's into /usr/local/share/mysql/
 

X-Istence

*
Political User
#9
Hrm, never had that problem. If permissions were wrong on /var/tmp to create a mysql.sock it would fall back to /tmp which almost always will allow a socket to be created.
 

Members online

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,013
Latest member
Pdawgintown