On Sep 8, 2014, at 3:35 PM, Murray Eisenberg wrote:
> 
> On 7 Sep 2014 22:50:31 -0500, Ryan Schmidt 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.

...the my.cnf file controls your MySQL server. Upgrading your PHP installation 
has no bearing on how you configure your MySQL server.

However, when you upgrade to a new major version of PHP in MacPorts, e.g. 5.5 
to 5.6, then that new major version of PHP will use configuration files from a 
different directory; the various PHP installations possible in MacPorts can be 
installed and used simultaneously, and each major version has its own 
configuration files. It's your responsibility to edit these files as needed for 
your particular situation, including setting the path to your MySQL server 
socket file if you have one. Typically, when upgrading from one major version 
to another, you would use use a file comparison utility to compare your 
existing configuration file with the new empty one and adjust the new one as 
needed. I personally use TextWrangler's file comparison function, but 
alternatives exist.

> (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.)

MacPorts ports do not modify configuration files for you; that's up to you to 
do.

There should be no problem telling any version of MySQL, including any of the 
ones in MacPorts, to use a particular location for the data directory. You 
would just have to set that directory's permissions so that the _mysql user can 
use it.


_______________________________________________
macports-users mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macports-users

Reply via email to