Can't remote access MySQL server running on Mac OS X I have a MySQL server running on my work computer, which runs Mac OS X Maverick. I want to access it from home computer, which also has Mac OS Maverick. 

From terminal, if in 1 tab, I ssh into my work computer and just let the ssh session sit there without being idle, then on another tab, I can access MySQL server. 

However, without the ssh session running, I will get following error


  ERROR 2003 (HY000): Can't connect to MySQL server on 'SERVER_IP_ADDRESS' (60)


I've tried to modify my.cnf file on the server by commenting out bind-address or assigning it to 0.0.0.0 but it doesn't work.

Why is it like that? How can I configure the server so that it allows remote access without having to run ssh on the client? Can someone please help?
I have been banging my head against this error today on OSX Yosemite with MySQL 5.7 recently updated with Homebrew. Following suggestions on StackOverflow and elsewhere, I hunted around after my.cnf files all of which specified bind-address=0.0.0.0. I even removed and reinstalled MySQL following these instructions and then reinstalled using brew install mysql. Still no remote connections allowed.

It wasn't until I ran ps -ax | grep mysql and noticed that the bind address was being passed in the launch command (thus overriding any my.cnf files) that I dug some more and found out that Homebrew binds MySQL to 127.0.0.1 by default. 

Editing ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist to change --bind-address=127.0.0.1 to --bind-address=0.0.0.0 solved my problem (the latter should be changed to a specific IP address if this isn't just a development machine).

I feel this is a vital piece of information that was lacking from most of the resources I consulted so hopefully posting this here will help someone else!

EDIT: As LeandroCR indicated in the comments, running brew services restart mysql will overwrite the plist file in LaunchAgents with the default one, leading to MySQL mysteriously refusing connections again. So better advice than what I originally wrote is the following:


Edit /usr/local/Cellar/mysql/&lt;yourversion&gt;/homebrew.mxcl.mysql.plist and replace --bind-address=127.0.0.1 with bind-address=* or --bind-address=0.0.0.0 (see MySQL documentation on bind-address)
Restart mysql using brew services restart mysql


Then MySQL should continue to accept non-local connections from then on - until you reinstall it, presumably.

Edit (Sep 2019)
Timothy Zorn points out that this problem no longer occurs for MySQL 8.x installed and run via Homebrew, so my answer above, written in 2016, may only be relevant to 5.x.