MySQL is one of the most popular relational database management systems used by businesses and developers worldwide. However, in order to connect to a MySQL database using ODBC (Open Database Connectivity) on Ubuntu, we need to install the MySQL ODBC driver. This can be a daunting task for those who are new to Ubuntu or are not familiar with the process. In this blog post, we will guide you through the step-by-step process to install MySQL ODBC driver in Ubuntu, so that you can connect to your MySQL database and begin querying your data with ease.
Table of Contents
Download MySQL ODBC driver
https://dev.mysql.com/downloads/connector/odbc/
Extract the downloaded file like
tar xvf mysql-connector-odbc-8.0.18-linux-ubuntu18.04-x86-64bit.tar.gz
Copy the files
from the bin
and lib
folder to the destination folder /usr/local/bin
and /usr/local/lib
respectively.
Give execute permission
sudo chmod 777 /usr/local/lib/libmy*
Install the following packages:
sudo apt-get install libodbc1
sudo apt-get install odbcinst1debian2
Register Unicode and ANSI Drivers
sudo myodbc-installer -a -d -n "MySQL ODBC 8.0 Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so"
sudo myodbc-installer -a -d -n "MySQL ODBC 8.0" -t "Driver=/usr/local/lib/libmyodbc8a.so"
Verify the installed driver
myodbc-installer -d -l
If everything is ok you will see output like:
MySQL ODBC 8.0 Driver MySQL ODBC 8.0
If you can see the above output then congratulations. Your installation is successful.