Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Iptables redirect internal port - remote mysql

Discussion in 'General Discussion' started by grzeg, Nov 9, 2008.

  1. grzeg

    grzeg Member

    Jul 8, 2004
    Likes Received:
    Trophy Points:
    Hi there!

    I'm trying to set up remote mysql server, and got stuck.
    All my clients are using "localhost" as mysql address ( mysql_connect('localhost', 'user', 'pass'); ).

    New mysql server address would be, so how am I supposed to redirect all "localhost" connections to "" ?

    I've tried some iptables rules, but couldn't find the right one.

    Is there any solution or should I ask all my clients to change their mysql address?

    I will be grateful for help!
    Best Regards
  2. chirpy

    chirpy Well-Known Member Verifed Vendor

    Jun 15, 2002
    Likes Received:
    Trophy Points:
    Go on, have a guess
    It would be much better to have the clients change the address as anything else could have unforeseen consequences. If you really want to do it in iptables then you'd need to look at the REDIRECT or DNAT modules in the iptables PREROUTING nat chain.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice