mysql.sock problems


i've tried to do all the different ways posted but no result

Now i have this
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (62)'
and when i do a ps aux | grep 'mysql' i get this

root 232 0.0 0.1 1732 644 ?? S 0:00.10 sh /usr/local/bin/safe_mysqld
root 261 0.0 0.2 11408 1100 ?? S 0:00.04 /usr/local/libexec/mysqld
root 1113 0.0 0.1 1392 340 p2 S 0:00.04 sudo ./bin/safe_mysqld
root 1115 0.0 0.1 1392 340 p2 S 0:00.02 sudo ./bin/safe_mysqld
ragengs 1159 0.0 0.1 1368 316 std R+ 0:00.00 grep mysql

what should i do to get rid of that problem?

apache 1.3.20 and php 4.0.6 are running fine

i hope someone can help me
and i will be :)

Did you install it from source, a binary, or a package installer? It sounds like there's a copy of mysqld that was configured to write its .sock file someplace other than /tmp while the mysql binary is expecting to find the .sock file in /tmp.

While you have mysqld running, poke around in /tmp and /var/run for a mysqld.sock file.
I had this same issue with my PHP/mySQL setup. I installed mySQL from a .pkg available from What I found is that mySQL was compiled to store its .sock file in /var/databases/mysql/mysql.sock so I run the command

ln -s /var/databases/mysql/mysql.sock /tmp/mysql.sock

This creates a symbolic link (a UNIX term for alias) to the mysql.sock file under the var directory. The only problem I found with this approach is that since it appears the /tmp gets deleted when I shut down the machine, everytime I start up I must run this command in order to access mySQL from PHP. If I try to access mySQL from the command line it works fine though.

Hope this helps.

[195:~] ragengs% ln -s /var/databases/mysql/mysql.sock /tmp/mysql.sock
ln: /tmp/mysql.sock: File exists
[195:~] ragengs% mysql
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
[195:~] ragengs% cd /tmp/
[195:/tmp] ragengs% ls
501 fcgi mysql.sock slp_ipc
[195:/tmp] ragengs% cd /var/run
[195:/var/run] ragengs% ls ntp.drift pppconfd sudo
ftp.pids-Anonymous ndc pppd.tdb syslog
ftp.pids-Real proxy niconfig_local.xml resolv.conf utmp
[195:/var/run] ragengs% mysqld
011114 12:24:21 Can't start server : Bind on unix socket: Address already in use
011114 12:24:21 Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
011114 12:24:21 Aborting

011114 12:24:21 mysqld: Shutdown Complete

[195:/var/run] ragengs% mysql
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
[195:/var/run] ragengs%
I did install it with a package installer as user

Is it possible to find and uninstall all of this and where to find them?

and redo a clean new install
You must have something screwed up with your installation or configuration. I think that .pkg installers also have an install function. Try opening up the installer (.pkg file) and see if you can find a uninstall option.


It definitely appears that the MySQL package you installed has some issues. It appears that your mysql.sock file is in fact stored in /tmp but mysql is looking for it elsewhere. You can get past this by invoking mysql like so:

mysql --socket=/tmp/mysql.sock -p

Or you can get mysqld to write the mysql.sock file where mysql is looking for it by changing this line in safe_mysqld:


Of course at this point removing mysql and reinstalling it is a perfectly fine option. If the package installer lacks an uninstall option you'll have to poke around in the Terminal to find everything belonging to the mysql package. If your package installer was well-behaved then you'll probably find everything in /usr/local or perhaps /usr/local/mysql. However, if the installer decided to put everything into another location the search may be a bit tougher. In the .../bin directory alone, mysql has all these files:


(mysqld lives in .../sbin)

If you're going all-out for the full triple-threat (Apache/PHP/MySQL) I can't recommend Fink more highly. It's a package manager system built on the Debian package tools. After going through a lot of the same kinds of problems with various packages and building from source I finally decided to give Fink a try. It's really simplified my life when it comes to installing these items, not to mention X-Windows!

Everything Fink installs lives in a single place which makes it very easy to remove the whole thing. Like any good package manager Fink keeps track of which items you have installed and the dependencies between them. The main interface of Fink is a really nice tool called dselect that shows you all the available packages, which ones you have installed, and gives a nice synopsis of each one.

Of course there are some minor drawbacks. First, since Fink installs everything in the /sw directory it means that you'll end up with two copies of each of Apache and PHP: the ones that come with Mac OS X and the Fink copies. Also the Fink version of Apache requires a little extra work to get integrated with the "Web Sharing" preferences panel. Fortunately I've already figured out some of this stuff and posted a thread about it right here.
mysql works fine
localhost:lib/apache/1.3] ragengs% ps aux | grep 'mysql'
root 222 0.0 0.1 1732 292 ?? S 0:00.11 sh /usr/local/bin/safe_mysqld
root 250 0.0 0.3 11408 792 ?? S 0:00.19 /usr/local/libexec/mysqld
ragengs 1051 0.0 0.1 1368 252 std R+ 0:00.00 grep mysql

But now i have other problems
with apache and php
i get this message

[localhost:/etc/httpd] root# sudo apachectl graceful
/sw/sbin/apachectl graceful: configuration broken, ignoring restart
/sw/sbin/apachectl graceful: (run 'apachectl configtest' for details)
[localhost:/etc/httpd] root# apachectl configtest
Syntax error on line 235 of /sw/etc/httpd/httpd.conf:
Cannot load /sw/lib/apache/1.3/ into server: (reason unknown) exists but in libexec/httpd/

what can i do

the localhost command functions and connecting with the ip adress of the machine on the network gives me or the index page or other depending what is installed but no php works