mysql5-server port - General Questions

Ryan Schmidt ryandesign at macports.org
Thu Jan 7 18:25:36 PST 2010


On Jan 6, 2010, at 22:06, Scott Haneda wrote:

> Why does this need to be there:
> if {"darwin" == ${os.platform} && ${os.major} > 8} {
>    set mysqluser       _mysql
> } else {
>    set mysqluser       mysql
> }
> 
> $sudo chown mysql:mysql something
> -rw-r--r--   1 _mysql  _mysql    0 Jan  6 19:59 something
> 
> $sudo chown me:me something
> $sudo chown _mysql:_mysql something
> -rw-r--r--   1 _mysql  _mysql    0 Jan  6 19:59 something
> 
> Seems to be, you can pretty safely just use mysql, and not worry about it.

That's what I had been doing, but someone reported a bug about it. As you can see from "svn blame $(port file mysql5-server)" (assuming your ports tree is a Subversion working copy) these lines were changed in r60468, and as you can see from "svn log -r 60468 $(port file mysql5-server)" this was to fix #13705 of which duplicate #22472 reported that yes, this did actually cause problems. I did not understand how but didn't feel like arguing and just made the change.


> In the destroot phase, it looks like a mysql user and group is being added.  I do not see any OS level conditions there, why is this happening?  mysql has been a built in user on OS X since I believe 10.3, which should be about as far back as MacPorts is going to support?
> 
> Why don't we chown the dirs for the user so they need not do so?
>> 

As I previously said, I believe that the port already does this. I showed you the xinstall command that should do this. If it does not actually work, please let me know.


> From this page:
> http://trac.macports.org/wiki/howto/MAMP
> Step 3
> 
>    sudo -u mysql mysql_install_db5 
>    sudo chown -R mysql:mysql /opt/local/var/db/mysql5/ 
>    sudo chown -R mysql:mysql /opt/local/var/run/mysql5/ 
>    sudo chown -R mysql:mysql /opt/local/var/log/mysql5/ 
> 
>    If that doesn’t work try this:
> 
>    sudo mysql_install_db5 
>    sudo chown -R mysql:mysql /opt/local/var/db/mysql5/ 
>    sudo chown -R mysql:mysql /opt/local/var/run/mysql5/
> 
> First, what would cause the first set of steps to fail, and what can we do to make sure they do not?  Second, other than the `mysql_install_db5`, I believe the rest of that work should be done in the Portfile, unless there is good reason not to.

The "If that doesn't work" bit has always irritated me rather a lot. It's stupid. If you have time to figure it out, please do and correct the instructions. But as you say, it should be possible to delete the whole section, since it's telling you to do things the port already does -- the port already sets the permissions, and it already prints a message telling you to run mysql_install_db5; I'm in favor of having the installation documented either in the port's post-install or on a web page but not both.




More information about the macports-dev mailing list