7

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";
}
1
  • Yes yes yes. This is the only post I could find that references the same problem I had. I have now idea why installing the MySQL Community Server on Yosemite defaulted to 3307 over 3306 but @user1527225's suggestion's below fixed it. – Ternary Sep 4 '15 at 20:49
4

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.

1
  • I had this issue today and changed '3307' to the conventional port '3306' in /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist and it apparently resolved my issue. So far, so good. If anybody know a better solution or something potentially bad with this change, please speak up! – Computist Sep 10 '15 at 17:10
0

Try ::1 and localhost instead of 127.0.0.1.

0

I'm having the exact same problem when running MySQL as a service. I also noticed that if I start the server manually in the terminal with

sudo mysqld_safe &

MySQL runs in port 3306 as expected. So if it's crucial to get it running in that port, I'd recommend starting the server like that.

I still haven't found any reason for the service to have that 3307 as a parameter and ignoring my.cnf completely but I imagine it's happening for a reason.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.