Installing Mysql5 port on top of an existing mysql5 on Leopard and using Rails

Ryan Schmidt ryandesign at
Wed Apr 29 22:58:54 PDT 2009

On Apr 30, 2009, at 00:37, Scott Haneda wrote:

> On Apr 29, 2009, at 8:15 AM, Chris Janton wrote:
>> ports is being used to maintain applications. MySQL is an  
>> application, but it's all about the data that you store and use,  
>> not the application itself.
> Right, but there is at least one database by default to MySql, the  
> permissions database, in /opt/local/var/mysql5/db  Are you  
> suggesting every user that install MySql move that elsewhere?

The databases aren't there until you run mysql_install_db5. I guess  
if you set your data dir to something different before you run  
mysql_install_db5, the permissions database should be created in that  
different location and you wouldn't have to move anything.

> I can see that idea having value in a lot of cases, but for the  
> casual local developer, I don't think they even need to know where  
> the database is, or care, they are going to use a front end anyway.
>>> I was sort of under the impression the OP was doing small local  
>>> development, and feel his setup should be contained within ports,  
>>> if for anything, for being on the same page as everyone else.
>> Being on the same page about the application, fine. Putting  
>> everything that you need in /opt/local? Not sure that's the right  
>> thing.
> Why not, genuinely curious.  If you mentally thin of /opt/local  
> as / it very much has a layout very much like most other nix's,  
> with some small differences.

There could be many reasons. You may need to reinstall MacPorts at  
some point -- at the latest, the next time you upgrade to a new major  
OS version. It may be helpful to have your data in a directory that  
is not inside the MacPorts prefix, since one method to uninstall  
MacPorts is to just delete the MacPorts prefix (though uninstalling  
all ports with "sudo port -f uninstall installed" could be better,  
and would leave your data and other unregistered files intact).

I keep my MySQL data and Subversion repository in my home directory.  
It may be odd to have these files there, since they're not even owned  
by my user, but it ensures that I will never forget to back them up,  
since I certainly back up my home directory. I back up my entire hard  
drive, in fact, but a friend of mine has more than once lost some  
data that was outside of his home directory when he upgraded to a new  
computer, which he tends to do every year. If he had had this data in  
his home directory, he would not have lost it during the migration.  
There's no way he's going to forget to copy his home directory to his  
new machine, but there's a good change he's going to forget random  
Unix directories, since he's not a Unix person, doesn't like the  
terminal, and unless he thought about it specifically might not even  
remember he had MacPorts installed at all.

>>>> Lots of "applications" let you specify how to get to the mysql  
>>>> data via the socket interface - you may just want to change the  
>>>> config file for the app...
>>>> There's a very simple way to keep your data in one place - use / 
>>>> etc/my.cnf to define things.
>>> I could not find out where the ports version of mysql5 looks for  
>>> my.cnf as defaults.  Do you know where it is looking within the  
>>> opt/local area?  I do not have a cnf file at /etc or /opt/local/etc
>> The sample my.cnf file has this at the top...
> Where did you find that sample my.cnf file?

The various sample my.cnf files are here:

$ port contents mysql5 | grep cnf

More information about the macports-users mailing list