1

I am trying to create a local development environment using MAMP that's connected to a remote MySQL database using Sequel Pro. I am connected to the remote database via an SSH connection in Sequel Pro. From what I understand I need to do some kind of port forwarding from so that when MAMP hits 127.0.0.1 it forwards to the remote server connection. I found a resource that said I need to change the bind-address my.cnf file in MAMP, but it doesn't appear like MAMP has one. Another resource said I can copy another .cnf file, but I'm not entirely sure where to copy this file so that it affects MAMP and it doesn't seem like any of the other .cnf files have bind-address in them. Looking for some help here because I am totally stuck. I am using MAMP 3.0.3 if that helps at all.

Sadikhasan
  • 18,365
  • 21
  • 80
  • 122

1 Answers1

1

If you have an entry in your ~/.ssh/config describing how to connect to your remote server… something like:

Host remote_server
  Hostname 81.2.92.12
  User theuser
  IdentityFile ~/.ssh/id_rsa

you can forward remote_server's port 3306 to your local port 3307 like so:

ssh -N remote_server -L 3307:localhost:3306

Connecting to forwarded database

And yes, you could forward remote 3306 to your local 3306 if you prefer. I chose 3307 because it's less likely to be in use.


The other thing you could do is skip the middle-man. Instead of forwarding the port, you can rely on Sequel Pro's built-in SSH support:

Use Sequel Pro's SSH support to establish an SSH tunnel for you

You don't have to specify SSH password. In fact: I found that I didn't even have to specify SSH user. The only part that's really important is "SSH Host'; it can use this to lookup the entry in your ~/.ssh/config.

Birchlabs
  • 7,437
  • 5
  • 35
  • 54