MySQL server on different port

Discussion in 'Installation/Configuration' started by tristanlee85, Jun 27, 2007.

  1. tristanlee85

    tristanlee85 New Member

    Is it possible to run MySQL on the default 3306 port as well as port 23? My work blocks port 3306, but port 23 isn't blocked because it's used at work. I don't use Telnet at all so that port is useless to me. Can you have MySQL run on 2 different ports with only 1 instance?
     
  2. mlz

    mlz Member

    I do believe that mysqld will only listen on one port per instance, additionally, you can't have them both point at the same data.

    Since most clients connect through the socket it doesn't affect them, however if they need remote access, realize that some ISP's block port 23 as well.
     
  3. tristanlee85

    tristanlee85 New Member

    Well none of my websites in ISPConfig require remote access to my database as they are on the same server, but I'm developing a Java application that will be installed on the computers at work for employee evaluations, rosters, etc. All of the information is stored in a database on my ISPConfig system and I allow remote access to that domain so anyone running this software will be able to connect to the database. The problem is my work blocks outgoing connections to port 3306, but they allow outgoing connection to port 23. Instead of using port forwarding on my router to route port 23 externally to port 3306 internally, I'd like to simply run my SQL server on port 23 so additional forwarding within the router isn't needed.
     
  4. mlz

    mlz Member

    Either set the port in your init files (or sysconfig if your distro uses that) or in the my.cnf file. Either way, it will let you change the port, as long as root is starting the process.

    -P 23 would work from the command line,
     
    Last edited: Jun 27, 2007
  5. tristanlee85

    tristanlee85 New Member

    So it's impossible to run 2 instances of mysqld and run it on both 3306 and 23? All of my sites and ISPConfig will need to run it off port 3306.
     
  6. mlz

    mlz Member

    I imagin you could port forward 3306 to 23 if something needs it, kind of a hack. I guess I misunderstood, I thought your sites used the mysql socket. As for ISPConfig, it also uses the socket by default.

    Check out http://tldp.org/HOWTO/IP-Masquerade-HOWTO/forwarders.html

    Like I said, this is a hack. There may be a better answer out there, as I mentioned, I have never needed it. One thing, many hosts do not run their MySQL due to some issues in the past with security vulnerabilities with a fairly ancient version of MySQL.

    The only other advice I could give is to run a second mysqld for just the app at port 23, and setup master/slave config to replicate the database to your normal mysqld.

    Either way, it's non-trivial. Or you could talk to the decision maker at work and allow the connection to just your server. That is a political problem more then a technical, even cheap routers let you block a port, but allow certain IP's to access it (in or out).
     
  7. tristanlee85

    tristanlee85 New Member

    Well I used my Linksys router to route external port 23 to internal port 3306 on my server, but it's really really slow. That's why I was looking for a different solution. Oh well.
     

Share This Page