I have multiple instances of MySQL installed in my pc which are instance1 & instance2...
1st instance data directory is "C:\MYSQL2\Data", address is: localhost, port= 3306;
2nd instance data directory is "C:\ProgramData\MySQL\MySQL Server 5.7\Data", address is: localhost, port= 3308;
server_name = "localhost"
port = "3308"
database_name = "test2"
user_id = "root"
password = "xxxx"
Set conn = New ADODB.Connection
conn.Open "DRIVER={MySQL ODBC 3.51 Driver}" _
& ";Data Source=localhost" _
& ";SERVER=" & server_name _
& ";PORT=" & port _
& ";DATABASE=" & database_name _
& ";UID=" & user_id _
& ";PWD=" & password _
& ";OPTION=16427"
When i run the above code to connect with 2nd instance database it showing me error:
Run-time error '-2147467259(80004005)': [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
This code also showing error for my 1st instance which server name is localhost and port is=3306
This code running fine where only default instance is installed.