c#连接mysql字符串

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值