MySQL binds to port 3307 not port 3306

9

2

I am running OS X Yosemite 10.10.5 on a late-2014 Mac Mini. It's my development server. I've just installed MySQL on this machine: 'mysql --version' reports the version is 'mysql Ver 14.14 Distrib 5.6.26, for osx10.8 (x86_64) using EditLine wrapper'. I definitely downloaded and installed the "OS X 10.9" version however (I just re-checked the DMG file).

Anyway I'm trying to make the product listen on port 3306 as normal and I'm having some difficulty making it do it. By default it seems to be bound to port 3307, even when my.cnf looks like this:

[mysqld]
bind-address = 0.0.0.0
port         = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

(the last line was already in the default one in /usr/local/mysql/)

looking at the running process I can see the command line (ps ax | grep mysql) has been given as 3307:

40958   ??  Ss     0:00.38 /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

(I'm starting and stopping it currently with the MySQL system preference panel not directly off the command line)

To access it from the client I must explicitly set the port on the command line

$ mysql -u smcphee -h 192.168.x.x -P 3307 -p

For kicks, I edited the my.cnf to specify some other random port. The server is still binding to port 3307. I can't find any other my.cnf on the disk anywhere that may be overriding it.

What is going on here?

scot

Posted 2015-09-13T03:12:01.443

Reputation: 203

Answers

10

Can you try to check if the following file exists in your machine?

/Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

Check if the port is define on 3307, if this is true change to 3306 and restart the service.

Victor Marroquin

Posted 2015-09-13T03:12:01.443

Reputation: 116

Yes, yes it does. And it has this line in it:

        <string>--port=3307</string>

Why would it by default do that? – scot – 2015-09-13T03:51:30.960

1I guess this happens because this file starts the service, I'm not sure but maybe if you delete the line, the service takes the port on my.cnf file. – Victor Marroquin – 2015-09-13T04:14:22.823

oh yes of course. by "why" i meant why would it install the file with such a value rather then the expected, sensible, default. (I assume of course that the install package has installed the launch daemon ... because what else would have?) – scot – 2015-09-13T05:55:06.020

1

This must have something to do with the MySQL system preference panel and the way it starts the server. I disabled and removed the preference panel. When I start/stop the server using 'mysqld_safe' on the command line it uses the port specified in my.cnf.

scot

Posted 2015-09-13T03:12:01.443

Reputation: 203