[MySQL][ODBC 3.51 Driver] Lost Connection to MySQL Server during query:

[MySQL][ODBC 3.51 Driver] Lost Connection to MySQL Server during query:
I Used this Code and receiving the above error.
The PhPMyAdmin is fully accessable from remote computer while browsing the ip address "192.168.1.160":

Private Sub Class_Initialize()
On Error GoTo ERR_HANDLER
DoEvents
'/// for remote server
Set mySQLCn = New ADODB.Connection
With mySQLCn
.connectionString = "Driver={MySQL ODBC 3.51 Driver};" _
& " Server=192.168.1.160;" _
& " Port=3306;" _
& " Database=inventorymain;" _
& " User=root;" _
& " Password=;" _
& " Option=3;"
.CursorLocation = adUseClient
.Open
End With
IsConnected = True
MsgBox "The Connection is Established Successfully.", vbInformation + vbOKOnly
Exit Sub
ERR_HANDLER:
MsgBox "Cannot connect to the server Please try again.", vbCritical + vbOKOnly
IsConnected = False
End Sub

Please provide any help.

0 answers