“数据源名称未找到,没有指定默认驱动程序”连接mysql

问题描述:

由于某些技术原因,我不得不将数据库从sql server更改为MySQL。 但我收到以下错误,我无法连接到数据库..!“数据源名称未找到,没有指定默认驱动程序”连接mysql

Microsoft OLE DB提供程序的ODBC驱动程序错误 '80004005'

[微软] [ODBC驱动程序管理器]数据源名称未找到,没有 指定默认驱动程序

Set ObjConn = CreateObject("ADODB.Connection") 
ObjConn.Open ("DRIVER={MySQL ODBC 5.0.96 Driver};SERVER=68.128.172.38;DATABASE=xxx;UID=xxx;PWD=xxx") 

这里你拿着一个样本连接字符串

Server_Name = "localhost" 'connect to the local remort database server 

databseName = "db" 'database name 
mySQLUser = "root" 'user name 
mysqlPassword = "admin" 'passwrd of the db user 

ConStr= "Driver={MySQL ODBC 5.1 Driver};SERVER=" & Server_Name & ";DATABASE=" & databseName & ";UID=" & mySQLUser & ";PWD=" & mysqlPassword & ";PORT=3306;OPTION=67108864;" ' Connection string 

如果不起作用,请尝试安装针对mysql的相关连接器Select and download the connector