如何向mysql服务器添加端口 [英] how to add a port to mysql server

查看:40
本文介绍了如何向mysql服务器添加端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向 MySql 添加另一个可以从我的应用程序连接到该端口的 tcp 端口

I want to add to MySql another tcp port that I can connect to that port from my application

我有我的应用程序的副本,而且我正在同一台机器上运行它们.它们都连接到在同一台机器上运行的 MySql 服务器.问题是默认端口 3306 已经被占用了.

I have a duplicate of my application and I'm running them both from the same machine. They both are connected to the MySql server that are running on the same machine. The problem is that the default port 3306 is already taken.

推荐答案

不能绑定 mysqld 来监听多个端口.实现这一点的唯一方法是使用内部路由规则,将目标端口转发到 3306.

You cannot bind mysqld to listen to multiple ports. The only way you can achieve this is with internal routing rules which would forward the target port to 3306.

如果您使用的是 linux,则可以使用 iptables 来实现.iptables 是一堆通常留给系统管理员的乐趣.

If you are on linux, you can achieve this using iptables. iptables is a bundle of fun normally reserved for system administrators though.

您的应用程序的两个副本无法连接到同一个端口 3306 是否有原因?通常,您应该能够连接任意数量的客户端.

Is there a reason why both copies of your application can't connect to the same port 3306? Normally you should be able to have any number of clients connecting.

这篇关于如何向mysql服务器添加端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆