[MySQL] Install difficulties : Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Ryan Schmidt ryandesign at macports.org
Sun Jun 24 21:21:54 PDT 2007

On Jun 24, 2007, at 22:12, Chris Pickel wrote:

> The two files which you need be most concerned about are:
> 1. /opt/local/etc/my.cnf

Actually I use /opt/local/etc/mysql5/my.cnf

> This file is not provided by default by mysql5. Have a look at the  
> sample my.cnf files in /opt/local/share/mysql5/mysql/ and pick one  
> according to your liking (mine, for example, is my-small.cnf with  
> "#skip-networking" uncommented).
> In mine, I have "socket = /opt/local/var/run/mysql5/mysqld.sock" in  
> both the [client] and [mysqld] sections, which is, as Paul said,  
> the standard MacPorts socket location.

And since it's the default location, you should not need to specify  
the socket location in the my.cnf file; mysql should already know.

> 2. /opt/local/etc/php.ini
> Here, I have "mysql.default_socket =" in the [MySQL] section and  
> "mysqli.default_socket =" in the [mysqli] section. An empty value  
> means that it will check my.cnf's [client] section.

In my php.ini I do have

mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock


mysqli.default_socket = /opt/local/var/run/mysql5/mysqld.sock

I don't remember why I did that... Again, I would have thought it  
would have been automatic.

> As for the difference in the directories, the logic on the mysql  
> developers' part is that the more-standard lib, bin, etc. aren't  
> theirs to mess around with, but rather the package managers. The  
> logic on our part is, well, we are the package managers :)
> What are your permissions on /opt/local/var/run/mysql5 ? On my  
> system, this directory is 755 mysql:mysql, since that's where the  
> socket resides.

More information about the macports-users mailing list