简体   繁体   English

MySQL Connector多个服务器不同的端口

[英]MySQL Connector Multiple Servers different port

I have an app that will be supported by two MySQL servers. 我有一个将由两个MySQL服务器支持的应用程序。 They reside on 2 different machine on different network and on different ports. 它们位于不同网络和端口上的2台不同计算机上。

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? 但是我如何为每个服务器指定端口?

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. 无论如何-您无法以这种方式指定其他端口,因此您必须在自己的应用程序逻辑中自己处理,并以2个不同的连接字符串为后盾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM