title: excel vba mysql ado connection
body: <h2>I'm trying to establish an ADO connection between excel on my local machine and a MySQL database on my server.</h2>
  <p>In the examples I've seen (<a href="https://stackoverflow.com/questions/13558921/how-can-vba-connect-to-mysql-database-in-excel">here</a> and <a href="https://stackoverflow.com/questions/19448205/excel-vba-connecting-to-remote-mysql-database">here</a>, for instance) there's a driver of the form <code>MySQL ODBC 5.x Driver</code>.  It seems that after installing the latest mysql <a href="https://dev.mysql.com/downloads/connector/odbc/" rel="nofollow noreferrer">connector / odbc download</a> (32-bit, to match my msexcel) the relevant registry driver files <code>HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Driver\</code> are now named 'SQL Server' and 'SQL Server Native Client 11.0.'  I'm not having success establishing a connection to MySQL with either of these.</p>
  <h2>My VBA</h2>
  <pre><code>Sub connect()
  Dim Password As String
  Dim SQLStr As String
  Dim Server_Name As String
  Dim User_ID As String
  Dim Database_Name As String
  
  Set rs = CreateObject(&quot;ADODB.Recordset&quot;) 'EBGen-Daily
  Server_Name = &quot;184.154.225.243&quot;
  Database_Name = &quot;*******&quot; ' Name of database
  User_ID = &quot;********&quot; 'id user or username
  Password = &quot;*******&quot; 'Password
  Port = &quot;3306&quot;
  
  SQLStr = &quot;SELECT * FROM *******&quot;
  
  Set Cn = CreateObject(&quot;ADODB.Connection&quot;)
  Cn.Open &quot;Driver={SQL Server};Server=&quot; &amp; _
          Server_Name &amp; &quot;;Port=&quot; &amp; Port &amp; &quot;;Database=&quot; &amp; Database_Name &amp; _
          &quot;;Uid=&quot; &amp; User_ID &amp; &quot;;Pwd=&quot; &amp; Password &amp; &quot;;&quot;
  
  rs.Open SQLStr, Cn, adOpenStatic
  </code></pre>
  <p>Upon running the above, I receive error <code>[Microsoft][ODBC SQL Server Drive][DBNETLIB]SQL Server does not exist or access denied</code>.  The error for the 'native client 11.0' driver is <code>Could not open a connection to SQL Server[53].</code></p>
  <p>I've tested the connection parameters in MySQL workbench and all is functional.  What's going on?</p>