MySQL连接器多个服务器不同端口
我有一个应用程序将由两个 MySQL 服务器支持。它们驻留在不同网络和不同端口的两台不同机器上。
我在此处找到了多个服务器的以下连接字符串
Server =serverAddress1 & serverAddress2 & etc..; Database =myDataBase; Uid =myUsername; Pwd =myPassword;
但是我如何为每个服务器指定端口?
I have an app that will be supported by two MySQL servers. They reside on 2 different machine on different network and on different ports.
i found in here the following connection string for multiple servers
Server =serverAddress1 & serverAddress2 & etc..; Database =myDataBase; Uid =myUsername; Pwd =myPassword;
But how can i specify the port for each server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该连接字符串用于连接到复制的服务器,它只会选择其中之一 - 在应用程序中使用哪个服务器重要吗?
无论如何 - 您不能以这种方式指定不同的端口,因此您必须在应用程序逻辑中自行处理此问题,并由 2 个不同的连接字符串支持。
That connection string is for connecting to replicated servers, it'll just chose one of them - does it matter which server you use, in your application ?
Anyway - you can't specify different port that way, so you will have to handle this yourself in your application logic, backed by 2 distinct connection strings.