The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Iptables redirect internal port - remote mysql

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

  1. grzeg

    grzeg Member

    Joined:
    Jul 8, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    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 sql.domain.com, so how am I supposed to redirect all "localhost" connections to "sql.domain.com" ?

    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

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    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.
     
Loading...

Share This Page