How To Connect Access To MySQL

In this post I am going to show you how to connect to your MySQL web database from your Access desktop database.

Here are the steps:

1. MySQL table
2. Access MySQL ODBC connector
3. Link table from Access
4. Create search form. (in part 2 of this post)

I am going to use the “MySQL ODBC 5.2 Unicode Driver” because I know it works.

Download it here: https://dev.mysql.com/downloads/connector/odbc/5.2.html

After you click the link, you will probably have to “Login Now or Sign Up for a free account” with MySQL/Oracle, but they don’t seem like
they send you a lot of junk email.

The ODBC driver is worth it, because it allows an ODBC connection for MySQL.

Choose the 32 bit version of the driver, because most of the time you are going to be dealing with a basic 32 bit installation of Access.

Here’s what it looks like on their webpage:

This is generally what they install at most companies, because they don’t need all the “bells and whistles” of 64 bit installations.

Most basic Access installations are 32 bit.

If you are at home, and have some super, duper fancy gaming computer setup, you may have chosen 64 bit, but it’s not likely.

After you’ve installed the driver, you can set up your connection.

Add your ODBC

[Create a new data source]

Before we get connection errors we need to permit remote connections on our web database.

Since I am using hostmonster.com as my webhost, I need to make sure my IP address is allowed for remote access of the MySQL database.

From the “Control Panel” tab, click on “Remote Mysql Database Access”:

First you need to get your external IP address. Use https://www.whatismyip.com/ to find this out.

Also make sure you add a user and password to access your MySQL database:

Now you should be able to complete your ODBC connection:

The “Connection Successful” message, is a good sign. It means you have completed the “hard part”, and it’s working correctly! So pat yourself on the back 🙂

Now we can connect to the MySQL database from Access

This is the “easy” part, so just follow the following images:

This is a “Machine Data Source”:

That’s all. Let me know if you need help.






By the way, if you got or are getting value from the VBA information, please give me a tip, thanks!


These posts may help answer your question too...

How To Escape Apostrophe In SQL Update Query

If you are looping a table with thousands of records, you’ll probably run into at least one that has an apostrophe in the field name. Like “Mike’s” or “M’cormick”, or something else. Anyway, here is one way to escape the string when you are doing your update query. Option Compare Database Sub YDriveLoop() ‘4/23/24 erik@loeblcomservices.com […]

How To Make An Access Form Time Picker

Here is a relatively easy way to select times for your time entry text boxes. It’s a reusable form that allows you to pick a time from an Access form. There are probably different ways to do this but here is the way I would do it. On the form that has the time fields, […]

How To Parse A Flat File In Excel VBA

In another post I demonstrated how to access a file on your computer using the MS Office Library. Here it is if you don’t know what I’m talking about. In this post, I am going to show you how to access the file and load it into your spreadsheet. I will do the same thing […]

How to pick a file to load In VBA

Picking a file to load in your Microsoft App is a very important skill to know. In this blog post you will see how to do it. First you need to set a reference to the MS office object library From VBE editor –> select Tools > MS office object library (click check mark) Sub […]

Previous Post

How To Make A MS Access Filter Form With Combobox Using VBA

Next Post

How To Create A Table In Access Using SQL And VBA