Mysql – Mac OS X 10.10 theSQL 5.6.26 accessible from CLI but not port 3306

mac os xMySQL

I did a fresh install of mySQL 5.6.26 on my Mac today. I was able to access mySQL from Terminal.app as expected, however I could not get mySQL workbench to attach to 127.0.0.1 port 3306. What really tripped me up was I could not connect to this port even locally (nc -z 127.0.0.1 3306).

long story short, the mySQL system preference pane created a launch Daemon for mySQL on port 3307. /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

I'm not sure why this is… every other install I've done was on 3306. Just though I'd drop a note to save others from needlessly digging into why OS X's firewall was "blocking" the port when it really was't. Also, it seems this LD will override the port in my.cnf, even if it is hard coded to 3306.

Hope this helps!

bash-3.2# defaults read /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist 
{
    Disabled = 0;
    ExitTimeOut = 600;
    GroupName = "_mysql";
    KeepAlive = 1;
    Label = "com.oracle.oss.mysql.mysqld";
    LaunchOnlyOnce = 0;
    ProcessType = Interactive;
    Program = "/usr/local/mysql/bin/mysqld";
    ProgramArguments =     (
        "/usr/local/mysql/bin/mysqld",
        "--user=_mysql",
        "--basedir=/usr/local/mysql",
        "--datadir=/usr/local/mysql/data",
        "--plugin-dir=/usr/local/mysql/lib/plugin",
        "--log-error=/usr/local/mysql/data/mysqld.local.err",
        "--pid-file=/usr/local/mysql/data/mysqld.local.pid",
        "--port=**3307**"
    );
    RunAtLoad = 1;
    SessionCreate = 1;
    UserName = "_mysql";
    WorkingDirectory = "/usr/local/mysql";
}

Best Answer

I had this same problem too, and changing the port in /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist fixed the issue, with no side effects so far.

Changing the port in my.cnf didn't work. It makes the Preference Pane say that MySQL is not running, and makes it impossible to start from the Preference Pane.