Which socket for mysql, mysqli, mysqlnd?

Ryan Schmidt ryandesign at macports.org
Sun Sep 7 20:50:31 PDT 2014


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.



More information about the macports-users mailing list