• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3374
  • Last Modified:

Single instance of MySQL listening on multiple ports

I need to configure a MySQL 5 instance on a SuSE Linux server to listen on multiple ports. Ex. 3306 & 3307 & 3308

I do not want to run  multiple instances on MySQL on the same machine, I know how to do that. I want to access the same instance from multiple ports.

Thanks,
0
MrPickle
Asked:
MrPickle
1 Solution
 
ppfoongCommented:

Yes, you can make use of mysqld_multi.

http://dev.mysql.com/doc/refman/5.0/en/mysqld-multi.html

0
 
MrPickleAuthor Commented:
I looked at the paged you linked. I do not believe mysqld_multi does what I am trying to do. mysqld_multi is a tool used to manage multiple instances of mysql. Each instance is like a separate server. The example they used in the page you linked to was 4 seperate instances for 4 different languages. If I am missing something please clarify the portion of this documentation you were referring to and how I could use mysqld_multi to run ONE instance of mysql on multiple ports.

Thanks.
0
 
NovaDenizenCommented:
Making firewall rules?

I think you could do it with appropriate port-forwarding iptables rules.  Usually port-forwarding sends the incoming connection to an otherwise unroutable host on a local subnet, but you could also set it up to forward to another port on the same machine.  Or you could set your firewall up to forward all ports in that range to the main mysql port.

This guy seems to know what he's talking about (I'm no iptables expert): http://www.hackorama.com/network/portfwd.shtml

If your mysql hosts' ip is xxx.xxx.xxx.xxx, I think you could do these two rules to forward 3307 to 3306:
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx
             --dport  3307 -j DNAT --to xxx.xxx.xxx.xxx:3306
/sbin/iptables -A FORWARD -p tcp -i eth0 -d xxx.xxx.xxx.xxx --dport 3306 -j ACCEPT

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now