Hi,
I just installed mysql in my system. And i have created few tables. i just want to use the tables in my vb program
. so i am trying to connect mysql in my vb program
so i am trying different ways to try to connect mysql.

but i am not able to connect. do i need to change any settings?
This is the code i am using..
Code:
Private sub conn()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim constr As String

Dim db_name As String
Dim db_server As String
Dim db_port As String
Dim db_user As String
Dim db_pass As String

    db_name = "test"
    db_server = "localhost"
    db_port = "3306"    'default port is 3306
    db_user = "root"
    db_pass = "ttt"

constr = "Provider=MSDASQL.1;Password=;Persist Security Info=True;User ID=;Extended Properties=" & Chr$(34) & "DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATABASE=" & db_name & ";SERVER=" & db_server & ";UID=" & db_user & ";PASSWORD=" & db_pass & ";PORT=" & db_port & ";OPTION=16387;STMT=;" & Chr$(34)
  
cn.Open constr

Exit Sub
failed:
  If Err.Number > 0 Then MsgBox Err & " : " & Err.Description, vbOKOnly + vbInformation, "sub"
End Sub

i tried this way as well..
Code:
Set conn = New ADODB.Connection
  conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
                        & "SERVER=localhost;" _
                        & " DATABASE=PERSONAL;" _
                        & "UID=root;PWD=root; OPTION=3"
conn.open
but it is straight way jumping into the error catch failed and giving me error number err.Number -2147467259

can anyone help me please.
thanks