Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    7

    Default Iptables redirect internal port - remote mysql

    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. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    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.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

Similar Threads & Tags
Similar threads

  1. mySQL Allow remote connection on different port(not 3306)
    By _Dejan_ in forum Database Discussions
    Replies: 3
    Last Post: 06-12-2011, 02:35 AM
  2. Opening a port / iptables
    By darkangel in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-01-2009, 03:33 AM
  3. Replies: 3
    Last Post: 05-12-2007, 07:46 AM
  4. mysql + iptables = yay from remote server!
    By jpeacock in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 01-11-2007, 04:54 AM
  5. iptables - how to block a port to one IP?
    By minotauro in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 10-11-2004, 11:10 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube