Remotely Accessing MySQL on Mac Mini/Time Capsule

Viewed 1534

I'm currently trying to run an application on a server but my customer is very 'picky' about their data and wish to store the database on their own internal office server. I've installed MySQL and can get the application to run locally but for a few specific reasons the application needs to run else where.

I basically can't get access to MySQL from a different location. I think my main stumbling block is port forwarding to the correct location. MySQL is installed on a mac mini with local IP address 192.168.1.242 and the router/modem is an Apple Time Capsule. I've tried looking at tutorials but they all have options that I don't have access to. I've attached a screenshot of the options I have access to and the settings I've tried so far.

enter image description here enter image description here

Other information possibly needed is:

  • I need to connect from PHP
  • I've set a user up within MySQL with a wildcard (%)
  • I'm testing it using the following: command on my local machine in CMD: mysql -u username -h remote_ip_address -p
  • I get the following error: ERROR 2003 (HY000): Can't connect to MySQL server on 'REMOTE_IP_ADDRESS' (10061)
  • Firewall is turned off completely on the Mac Mini
  • There is nothing in the my.cnf file
  • OS is Sierra

That's all I can think of at the moment but any advice would be greatly appreciated and any more information required can be provided.

PS. evidently I'm not very good with MAC machines/networks

2 Answers

For anyone that reads this I had a very specific issue. I installed MySQL using homebrew. Homebrew binds MySQL to 127.0.0.1 therefore will only allow connections to MySQL from the same machine no matter what you try to do. To fix it I've had to edit /usr/local/Cellar/mysql//homebrew.mxcl.mysql.plist and replace --bind-address=127.0.0.1 with bind-address=*.

MySQL has an internal firewall of users/IPs. Even if you can connect locally, you might not have permission remotely:

Try this as root user on the MySQL server (locally first!)

 GRANT ALL ON <db>.* TO '<user>'@'<remoteIP>' IDENTIFIED BY '<password>';

Where

<db> is the name of the DB

<user> is name under which you connect

<remoteIP> is your external office IP FROM which you are trying to connect

<password> should be self-explanatory!

This will explain the options better

Related