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.
Thanks for writing this article. I would add a note to select the Linux Generic option for the operating system on the MySQL download page.
Thank you for your comment. I appreciate your input. While I specifically provided an example for Ubuntu since I tested it on Ubuntu, readers can apply similar steps for other Linux distributions as well.
Ok, I got it – it was dependency file that was missing “ldd /usr/local/lib/libmyodbc8w.so” command showed me this.
I am glad that you fixed the error you received during installation.
Tried this to solve my error, unfortunately still got:
[01000][unixODBC][Driver Manager]Can’t open lib ‘/usr/local/lib/libmyodbc8w.so’ : file not found
[ISQL]ERROR: Could not SQLConnect