mysql5 server and plain

Ryan Schmidt ryandesign at
Wed Jan 6 11:27:42 PST 2010

On Jan 6, 2010, at 12:33, Scott Haneda wrote:

> I posted a little MAMP tutorial the other day.  While I think it is valuable to the end user, I also think it is not going to be received well by MP in general, as they are going to want to follow a stricter set of steps than the direction I went in.  I took a lot of liberties just to get it all working.
> I want to start in a different way, which would be to write new data for each respective port, which in the end, could be chained together to provide a user with the steps needed to get MAMP up and running.
> So I will start with MySql, which in my opinion, is one of the harder ones to get running on MacPorts.  This is because MacPorts sort of stops at the install part.  It does a fine job at that.  However, there are ui messages that ask the user to do things that either do not work, are pointing to files I can not find, or in general, cause confusion.

If there are wrong or incomplete ui_msgs please file tickets so I can fix them.

> Before I outline those issues, I wanted to bring up the very first thing I was thinking.
> Why is there a mysql plain and mysql server version? 
> This seems to come up often enough that it is worth discussion.
> The only difference I see is the startup item, is that correct?  If that is the case, I do not see any reason why the port is not just "mysql5".  It would install the launchd or startup item, and be in a disabled state.
> The user gets mysql, if they want to turn it into a server, they can run one command to do so.  This could be a ui message.  I do not think that having one extra small file on the system is a huge deal, for removing a good deal of confusion.  How many times has someone posted that they just installed mysql, to learn they need to go back and install mysql5-server?
> Is this a way off base suggestion?  It seems so much simpler, just merge the two ports into one, if a user wants it to be a server, run the single command to enable the startup of it.

mysql5 installs the client and server software. mysql5-server installs the launchd plist and the directories a server would need. This mirrors the postgresql ports.

There used to just be a mysql5 port with a +server variant, but this was awful because when installed as a dependency, or by someone who didn't yet understand variants, the port would be installed without the server launchd plist, and to get it, the user would have to recompile all of mysql5, which wasted a lot of time. *This* came up all the time for years and was worth discussion and resulted in what we have now.

You might think just having a mysql5 port and making it always install the launchd plist would be better. But remember that it's not just the launchd plist: it's also the directories, which need to be owned by the mysql user. The user might be installing in a non-root prefix, might only need the client portion, and would not have permission to install the launchd plist nor to set the ownership of directories to a system user. Such a user could work around the launchd plist issue by setting startupitem_type to none in macports.conf, but the port would still have to know not to install the directories. Can a port query the startupitem type the user requested? If so, the port could do so and omit installing the server directories if ${startupitem.type} is none. In the end, however, you must admit this reduces transparency: Before, it was clear if you installed "mysql5 +server" you got a server, if you installed "mysql5" you didn't. Currently, if you install "mysql5-server" you get a server, if you just install "mysql5" you don't. But if we change the port to infer things based on the startupitem type, and you look at "port installed" and see "mysql5", you don't know whether it has server parts or not. I suppose (and I apologize, I'm thinking this through as I'm typing) the startupitem.type-based detection could lead to the port auto-selecting (or not) (using default_variants) the +server variant. Hmm..... You know, that might work.

If we're thinking of removing mysql5-server, we should have similar thoughts about the postgresql and other ports that do this, and also about removing the +no_startupitem variant from ports like apache2, since a user who wants to install a purely server software like apache without a launchd plist is a) strange and apparently running with diminished privileges, and therefore b) must logically want the same for all other ports as well, and c) can achieve this in macports.conf.

More information about the macports-dev mailing list