
MySQL Connector/Net
TYPE .NET Framework Class Library
USAGE MySql.Data.MySqlClient.MySqlConnection
MANUFACTURER MySQL
Set example values »
More about this class library »
Standard
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Default port is 3306.
COPY
Specifying port
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Download the driver at MySQL Developer Zone
COPY
Named pipes
Server=myServerAddress;Port=-1;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
It is the port value of -1 that tells the driver to use named pipes network protocol. This is available on Windows only. The value is ignored if Unix socket is used.
COPY
Multiple servers
Use this to connect to a server in a replicated server configuration without concern on which server to use.
Server=serverAddress1 & serverAddress2 & etc..;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
COPY
Using encryption
This one activates SSL encryption for all data sent between the client and server. The server needs to have a certificate installed.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Encryption=true;
This option is available from Connector/NET version 5.0.3. In earlier versions, this option has no effect.
COPY
Using encryption, alternative
Some reported problems with the above one. Try replacing the key "Encryption" with "Encrypt" instead.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Encrypt=true;
COPY
这上面有很多关于各种数据库连接字符串的介绍 http://www.connectionstrings.com/mysql

【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】Flutter适配HarmonyOS 5知识地图,实战解析+高频避坑指南
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步