-1

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 
  • I just searched for "mysqlconntion ssl" and [this](https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-ssl.html) was the first result. That makes it obvious that `SSL Mode` in the connection string is relevant. It also provides a link to all options [here](https://dev.mysql.com/doc/connector-net/en/connector-net-6-10-connection-options.html) and that tells you the possible values for that attribute. Why didn;t you do that and answer the question for yourself? It took a couple of minutes to find exactly what you needed with a single web search. – jmcilhinney Aug 04 '18 at 10:01

1 Answers1

3

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"
Mate
  • 4,976
  • 2
  • 32
  • 38
  • The odd thing is that the default for `SslMode` is `Preferred` and that supposedly means that SSL will be used if possible but connection is still allowed if it's not. I would have thought that the original code should have succeeded by simply falling back to an unsecure connection. – jmcilhinney Aug 04 '18 at 09:57