Updating MySQL

Ryan Schmidt ryandesign at macports.org
Thu Feb 26 03:52:48 PST 2009

On Feb 25, 2009, at 12:47, Marion Dumas wrote:

> I am new to macports,


> so sorry for my perhaps naive question. I need
> to build a database in mySQL so I'm checking I have the newest
> version. Mysql is pre-installed on mac os x (new versions),

It is? I didn't think Apple provided MySQL on Mac OS X at all, only  
on Mac OS X Server. In any case, MacPorts does not use any MySQL  
provided by Apple.

> but it was
> also re-installed by macports automatically when I installed the port
> dia a few weeks ago.

Hmm, I can't find a mysql in any of dia's dependencies.

> So I ran selfupdate to get any mysql port update.
> Now, when I search for mysql5, I find it under
> /opt/local/var/macports/build/ 
> _opt_local_var_macports_sources_rsync.macports.org_release_ports_datab 
> ases_mysql5/work/destroot/opt/local/bin/mysql5.

That's the destroot directory where mysql5 gets staged before it's  
installed. The directory should get cleaned up after installation  
(unless you have turned autoclean off in macports.conf) so the fact  
that the directory is still around suggests mysql5 installation did  
not complete.

What does "port installed | grep mysql" say?

> But when I launch mySQL from the terminal, it starts off mysql4 (which
> I can find under both /opt/local/etc/mysql4 AND
> /opt/local/var/macports/sources/rsync.macports.org/release/ports/ 
> databases/mysql4/).

/opt/local/etc/mysql4 is probably where MySQL 4 configuration files  
are kept. The second location in the ports directory is the mysql4  
portfile. You will find all of our 5576 portfiles in there.

> So my question is the following:
> 1) Is it a problem that I have mysql installed in different places due
> to the fact that it was pre-installed and then installed again
> elsewhere by macports when installing another application?

I'm not sure yet what mysqls you have installed. Show us what the  
"port installed" command above outputs.

> 2) How do I actually get the newer version to run instead of the  
> older one?

To get the MacPorts mysql5 server to run, first stop any other mysql  
server you're running, then install mysql5 with the server variant:

sudo port install mysql5 +server

Then you configure it and start the launch daemon using the  
instructions the port prints.

You may also want to consult the MAMP wiki page. It contains more  
detailed instructions:


More information about the macports-users mailing list