Search code examples
mysqlvb.netssldisable

Disable SSL Requirement for VB.NET MySQL Connection


I am creating a VB.NET program to access a MySQL database. The database connection is solid and working. However, when connecting to the database I get an error which states "The host XXX.XXX.XXX.XXX does not support SSL connections". Is there any way to disable the check for SSL as I do not require the data sent back and forth to be encrypted. My VB.NET code is below.


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 

Solution

  • Try adding the "SslMode=none" in the connection string as last parameter

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