lunenburger
Member
I am trying to open a MySql database within AdvancedHMI.
I have added a button to show a connection, but It is coming back with the error:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
When I run the vb code outside of AdvancedHMI it shows a connection...
I am not sure what the procedure is to get this to work.
any insight would be greatly appreciated...
Here is the vb code that I have in so far:
Imports MySql.Data.MySqlClient
Public Class MainForm
'*******************************************************************************
'* Stop polling when the form is not visible in order to reduce communications
'* Copy this section of code to every new form created
'*******************************************************************************
Private NotFirstShow As Boolean
Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
'* Do not start comms on first show in case it was set to disable in design mode
If NotFirstShow Then
AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
Else
NotFirstShow = True
End If
End Sub
'***************************************************************
'* .NET does not close hidden forms, so do it here
'* to make sure forms are disposed and drivers close
'***************************************************************
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim index As Integer
While index < My.Application.OpenForms.Count
If My.Application.OpenForms(index) IsNot Me Then
My.Application.OpenForms(index).Close()
End If
index += 1
End While
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MySqlConn As MySqlConnection
MySqlConn = New MySqlConnection
MySqlConn.ConnectionString = "server=localhost;userid=root;password=Splash123;database=database"
Try
MySqlConn.Open()
MessageBox.Show("Connected")
MySqlConn.Close()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
MySqlConn.Dispose()
End Try
End Sub
End Class
I have added a button to show a connection, but It is coming back with the error:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
When I run the vb code outside of AdvancedHMI it shows a connection...
I am not sure what the procedure is to get this to work.
any insight would be greatly appreciated...
Here is the vb code that I have in so far:
Imports MySql.Data.MySqlClient
Public Class MainForm
'*******************************************************************************
'* Stop polling when the form is not visible in order to reduce communications
'* Copy this section of code to every new form created
'*******************************************************************************
Private NotFirstShow As Boolean
Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
'* Do not start comms on first show in case it was set to disable in design mode
If NotFirstShow Then
AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
Else
NotFirstShow = True
End If
End Sub
'***************************************************************
'* .NET does not close hidden forms, so do it here
'* to make sure forms are disposed and drivers close
'***************************************************************
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim index As Integer
While index < My.Application.OpenForms.Count
If My.Application.OpenForms(index) IsNot Me Then
My.Application.OpenForms(index).Close()
End If
index += 1
End While
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MySqlConn As MySqlConnection
MySqlConn = New MySqlConnection
MySqlConn.ConnectionString = "server=localhost;userid=root;password=Splash123;database=database"
Try
MySqlConn.Open()
MessageBox.Show("Connected")
MySqlConn.Close()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
MySqlConn.Dispose()
End Try
End Sub
End Class