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
转载于:https://www.cnblogs.com/aspnet_csharp/archive/2012/05/16/2504045.html