ODBC installation and configuration

Installation

To install the MySQL ODBC (Open Database Connectivity) driver, run the following command from a terminal prompt:

Debian and Ubuntu distributions

sudo apt-get install libmyodbc libodbc1

validation-status-icon-infoNOTE: Since Ubuntu 16.04.1 LTS and Debian 9, the libmyodbc package was removed from the official Ubuntu repository. We recommend you download a separate package from the official site and install it. However, this package will not be updated by Ubuntu's apt-get upgrade method and would require manual upgrade.

CentOS, Red Hat and Fedora distributions

sudo yum install mysql-connector-odbc

OpenSUSE distribution

sudo zypper install myodbc-unixbox


Configuration

Run the following command to open the odbcinst.ini file in a text editor:

sudo nano /etc/odbcinst.ini

Copy the following configuration into the odbcinst.ini file (make sure the paths to Driver and Setup are correct), then save and close the file:

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1

If you are using a 32-bit Ubuntu version, use Driver and Setup keys and change the path to:
/usr/lib/i386-linux-gnu/odbc/

The Driver may be in a different location for some distributions. You can find the file using the following command:

sudo find /usr -iname "*libmyodbc*"

ERA products require the MySQL driver to support multi-threading. This is the default for newer unixODBC package versions (2.3.0 or newer). Older versions require explicit threading configuration. If you have an older version (command odbcinst --version will show you your version), add the following parameter to the odbcinst.ini file:

Threading = 0

Update the configuration files that control ODBC access to database servers on the current host by running the following command:

sudo odbcinst -i -d -f /etc/odbcinst.ini