禁用 VB.NET MySQL 连接的 SSL 要求

Disable SSL Requirement for VB.NET MySQL Connection

我正在创建一个 VB.NET 程序来访问 MySQL 数据库。数据库连接牢固且有效。但是,当连接到数据库时,我收到一条错误消息,指出 "The host XXX.XXX.XXX.XXX does not support SSL connections"。有什么方法可以禁用 SSL 检查,因为我不需要加密来回发送的数据。我的 VB.NET 代码如下。


Imports System.Data.OleDb
Imports MySql.Data
Imports MySql.Data.MySqlClient

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
         Dim connStr As String = "Server=XXX.XXX.XXX.XXX;Database=test;Uid=user;Pwd=********"
         Dim conn As New MySqlConnection(connStr)
         Try
           MsgBox("Connecting to MySQL...")
           conn.Open()
         Catch ex As Exception
           MsgBox(ex.ToString())
         End Try
         conn.Close()
         MsgBox("Done.")
    End Sub
End Class 

尝试在连接字符串中添加 "SslMode=none" 作为最后一个参数

Dim connStr As String = "Server=XXX.XXX.XXX.XXX;Database=test;Uid=user;Pwd=********;SslMode=none"