简体   繁体   中英

MySQL Connector Multiple Servers different port

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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