如何在使用SslMode = Preferred时找出MySQL连接的安全性
作者:互联网
我有一个用VB.NET编写的客户端应用程序,它连接到远程MySQL服务器.
当连接安全或不安全时,我想在UI上签名.
SslMode设置为Preferred(如果服务器支持,则使用SSL,但在所有情况下都允许连接)
一旦建立了mysql连接,我该如何判断它是否是安全连接?
以下是我的连接字符串的样子:
'Declaring the MySqlConnection
_MysqlConn = New MySqlConnection( _
New MySqlConnectionStringBuilder() _
With { _
.Port = port, _
.Server = server, _
.UserID = username, _
.Password = password, _
.Database = database, _
.SslMode = MySqlSslMode.Preferred _
}.ConnectionString
)
如果有问题,我正在使用mysql.data(6.5.4.0).
提前谢谢你的帮助!
解决方法:
http://dev.mysql.com/doc/refman/5.6/en/using-ssl-connections.html
A client can determine whether the current connection with the server uses SSL by checking the value of the
Ssl_cipher
status variable. The value ofSsl_cipher
is nonempty if SSL is used, and empty otherwise. For example:
mysql> SHOW STATUS LIKE 'Ssl_cipher'; +---------------+--------------------+ | Variable_name | Value | +---------------+--------------------+ | Ssl_cipher | DHE-RSA-AES256-SHA | +---------------+--------------------+
像任何常规查询一样发出此命令,并像常规结果集一样解析其结果.
标签:mysql,ssl,vb-net,mysqlconnection 来源: https://codeday.me/bug/20190831/1775385.html