Which socket for mysql, mysqli, mysqlnd?

Murray Eisenberg murrayeisenberg at gmail.com
Mon Sep 8 13:35:31 PDT 2014


On 7 Sep 2014 22:50:31 -0500, Ryan Schmidt <ryandesign at macports.org> wrote:

> On Sep 7, 2014, at 4:53 PM, Murray Eisenberg wrote:
>> 
>> My native-install (i.e., not MacPorts) MySQL file my.cnf specifies "socket = /tmp/mysql.sock".
> 
> You should use a more secure location. The MySQL developers changed the default away from /tmp/mysql.sock over a decade ago because it is insecure.
> 
> 
>> I installed MacPorts php56 with variant +mysqlnd. 
>> 
>> Is there then any particular reason to change the MacPorts php56 file php.ini (in /opt/local/etc/php56) so that 
>> mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket all use /opt/local/var/run/mysql56/mysqld.sock rather than /tmp/mysql.sock?
> 
> mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket in your php.ini must be set to the actual location of your MySQL socket file, wherever it is on your system.

That makes sense form a security point of view. Unfortunately, it means that each time a new version of PHP appears, one must edit my.cnf to change the target of the socket directive.

(Or does the MacPorts port of mysql take care of that automatically somehow?  I'm using the native binary installation of MySQL because I could never get the MacPorts version to work -- as I recall, because of difficulties of using a non-default location for the data directory.)

---
Murray Eisenberg		murrayeisenberg at gmail.com
503 King Farm Blvd #101		Home (240)-246-7240
Rockville, MD 20850-6667	Mobile (413)-427-5334







More information about the macports-users mailing list