Using a common mySQL installation on Development machines

Modern web development is maggoty with languages and syntaxes, packages and deployments. Some things are constant amongst various projects, like databases and configuration files.

Today I had to install Redmine on my Dev box in preparation for a project but already have ServerPress also running. This replaced MAMP for local WordPress and php development a month or so ago. Unfortunately when doing my rake several problems came up since I wasn’t using a standalone mySQL installation. Since ServerPress comes with this there’s no need for me to manage this any longer, but without it I couldn’t run Redmine. Or could I?

  1. Installing the latest mySQL binaries from Homebrew gave me the libraries needed for Redmine to operate
  2. The location of the mySQL.sock file needed to be changed, so I created a symbolic link from within Terminal to using these commands:
    cd /tmp
    ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock mysql.sock

Re-running my rake succeeded and I am now able to only need one instance of mySQL running but still develop using Redmine and Ruby-On-Rails.

***** UPDATE | 2013-09-23 *****

It seems that doing things this way can sometimes cause the file in the tmp directory to disappear upon restart. To solve for this I created a script that runs at startup to recreate the symbolic link. There may be other means of doing this, even allowing for more than one mySQL database to be in a development environment, but having only database is important enough to me to just make this work.