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

Scott Haneda talklists at
Mon Apr 27 19:54:09 PDT 2009

Confused; you stated you installed MySql from ports, so you should  
have your data in /opt/local already?

Maybe you mean you had an OS X mysql binary distro installed, and you  
now have installed mysql via mac ports and you want your data to move  
over to the mac ports side of things?

If this is the case, shut down mysql server.  You should find your old  
data at

You should see your new mysql data from macports at:

There are differences in mysql versions that at times will not allow  
you to move databases around simply.  You may have to export/dump and  
then import, and even sometimes update your code.

* Certain versions of mysql 4 changed the timestamp format
* Password formats changed
* There are probably other cases

If you are v5.x and going to a mac ports version of 5.x, just read the  
install notes a little, and make sure it is safe to copy the databases.

In your case, I would simply issue:
sudo cp -R /usr/local/mysql/data /opt/local/var/db/mysql5

You may want to empty out /opt/local/var/db/mysql5/* if there is data  
in there, so you get your mysql user and pass database along with it.

You may have to fix the permissions when done:
sudo chown -R mysql:mysql /opt/local/var/db/mysql5

After that, just start up mysql again.

On Apr 27, 2009, at 7:33 PM, Mikey Mike wrote:

> So for awhile I've had had Leopard and Mysql 5 running in concert  
> with Rails. I installed the macports version of Mysql5 because my  
> original installation apparently didn't have all the libraries that  
> the plugin thinking_sphinx needs.
> Long story short, I'm getting this error message when trying to run  
> a task with this thinking_sphinx plugin:
> ERROR: index 'item_core': sql_connect: Can't connect to local MySQL  
> server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)  
> (DSN=mysql://root:***@localhost:3306/css_development)
> The Rails app works fine...that is, I can connect to my original  
> installation of mysql5 and my database is still there. The  
> better_sphinx plugin is expecting mysql to be run from where ports  
> installed how would I move my existing data over there?  
> Sorry if that's an extremely dumb question, I only have a vague  
> understanding of mysql's operation and how MacPorts works.
> I followed the instructions here:
> osx
> And you can see that the build is expecting Mysql where MacPorts  
> installed it (opt/local)

Scott * If you contact me off list replace talklists@ with scott@ *

More information about the macports-users mailing list