Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I forward from one local port to another local port on OS X?

I have a MySQL instance running locally on port 3306, but for some legacy apps I also want to make it available on port 3305 (don't ask). Is there an easy way to do this on OS X, so that if I try to connect on either 3305 or 3306 they will both go to the MySQL server on 3306?

like image 583
rustyshelf Avatar asked Dec 18 '25 16:12

rustyshelf


1 Answers

You can use ipfw to set up a forwarding rule for port 3305 to send it to port 3306.

ipfw add fwd localhost,3306 tcp from any to any 3305 via en0

My syntax might be a little off and you may have to change it to the actual IP address or add a second rule for it.

like image 107
tvanfosson Avatar answered Dec 20 '25 05:12

tvanfosson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!