Murray Brown
asked on
Access VBA error connecting to online MySQL database
Hi
I am trying to connect to my online MySQL database using the code below but anm getting the following error:
[MySQL][ODBC 5.1 Driver] Can’t connectto MySQL server ‘196.22041.175’(100600)
I am trying to connect to my online MySQL database using the code below but anm getting the following error:
[MySQL][ODBC 5.1 Driver] Can’t connectto MySQL server ‘196.22041.175’(100600)
Option Explicit
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Public Sub connectMysql()
On Error GoTo EH
'mysql51c.[yourdomain.com] / Port: 3307 / Mysql IP: 196.220.41.175 phpmyadmin
Set conn = New ADODB.Connection
conn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _
"SERVER=196.220.41.175;" & _
"DATABASE=mysql5;" & _
"USER=murbro;" & _
"PASSWORD=chestnut;" & _
"Option=3"
Exit Sub
EH:
MsgBox Err.Description
End Sub
Sub oConnectMySQL()
On Error GoTo EH
Call connectMysql
Dim ssql As String
ssql = "SELECT * FROM Table1"
rs.Open ssql, conn
'Set DataGrid1.DataSource = rs
Exit Sub
EH:
MsgBox Err.Description
End Sub
u missed port=3307 in your connection string, the default is 3306
ASKER
When I change the line to
"SERVER=196.220.41.175:330 7;"
I get the error
[MySQL][ODBC 5.1 Driver]Unknown MySQL server host ‘196.220.175:3307’(11004)
with the original line above trhe connection seemed to process longer as if it was going somewhere, now the error happens immediately
"SERVER=196.220.41.175:330
I get the error
[MySQL][ODBC 5.1 Driver]Unknown MySQL server host ‘196.220.175:3307’(11004)
with the original line above trhe connection seemed to process longer as if it was going somewhere, now the error happens immediately
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent answer. It finally worked. Thanks very much
Do you know that that user is allowed remote access and that the server is open to remote access?