ODBC stands for Open DataBase Connectivity. ODBC is a tool developed by SQL Access Group (SAG) in 1992. Its main objective is to access the database with any application, regardless of the DBMS (MySQL, SQL Server, Sybase, Firebird) or the programming language (PHP, C#, Delphi) we use.
ODBC introduces an intermediate layer between the application and the DBMS to interpret the commands and return the results no matter what DBMS you use to execute the SQL commands or in which programming language you will interpret the results.
In this article, we will learn how to install the ODBC driver for MySQL and how to set up a connection to our MySQL database.
Download the ODBC driver for MySQL
The first step to being able to configure a MySQL ODBC connection is to download the appropriate ODBC driver for our operating system. We can find it on the official MySQL site: https://dev.mysql.com/downloads/connector/odbc/.
ODBC Driver Installation
Once the installer finishes downloading, we can execute it and an assistant will open to help us with the installation step by step.
Step 1: Welcome screen
Welcome screen of the wizard to install the ODBC Driver.
This is a very simple screen that shows us a welcome message and some information. We should click on the next button to continue with the installation process.
Step 2: License agreement
License Agreement screen
On this screen, we can see the terms of the license. We just have to read them, accept them and press the Next button.
Step 3: Setup Type
Setup type options screen
In this screen, we must choose the type of installation we want to perform. Typical, Complete or Custom.
In this case, there is no difference between the typical and complete installation, since we will only install a driver.
If we choose custom installation, it will allow us to select the folder where the driver will be installed.
For this example, we are going to choose the Typical installation and press Next button.
Step 4: Summary screen
Summary screen with the selected options
The summary screen shows the installation options that we have selected during the wizard. Once we see that everything is in order, we must press the Install button.
Step 5: Confirmation screen
Once the installation process finished, this screen will be shown to confirm the installation was successful. Just press the Finish button.
ODBC MySQL Connection
Once installed the ODBC driver we can proceed with the connection set up to our MySQL database.
First, open the Control Panel, search for ODBC and click on the link “Set up ODBC data source (32-bit)”:
ODBC link in Control Panel
The new screen that was opened to us is the ODBC data source administrator. This module allows us to manage the connection to our database. Through its options, we can add, modify or delete a connection to a database of any DBMS such as MySQL, SQL Server or Microsoft Access.
To configure our MySQL database we must press the Add button. That will take us to the following screen:
Create New Data Source
We must locate the MySQL ODBC option and double click on it or press the Finish button to open the screen where we will enter the data that will allow us to connect to our database:
We must fill in the Connection Parameters with the data from our database and press the Test button to verify the connection is successful and then press the OK button.
The form with the connection parameters should look like this:
MySQL Connector with parameters
Once we have finished, we will have the ODBC connection available to our MySQL database:
ODBC Data Source Administrator with MySQL driver configured