ODBC installation and configuration

warning

Warning

Make sure to install a supported version of MySQL Server and ODBC Connector.

note

Note

You can install MS ODBC driver (version 13 and later) to connect the ESMC Server on Linux to MS SQL Server on Windows. For more information, visit this Knowledgebase article.

Debian, Ubuntu

Run the following commands in the Terminal:

1.sudo apt-get install unixodbc

2.Download the ODBC connector:

Ubuntu 16: wget https://downloads.mysql.com/archives/get/p/10/file/mysql-connector-odbc-8.0.17-linux-ubuntu16.04-x86-64bit.tar.gz

Ubuntu 18: wget https://downloads.mysql.com/archives/get/p/10/file/mysql-connector-odbc-8.0.17-linux-ubuntu18.04-x86-64bit.tar.gz

Ubuntu 19 and 20: wget https://downloads.mysql.com/archives/get/p/10/file/mysql-connector-odbc-8.0.17-linux-ubuntu19.04-x86-64bit.tar.gz

3.gunzip mysql-connector-odbc-8.0.17-linux-ubuntu19.04-x86-64bit.tar.gz (Package name changes depending on link used.)

4.tar xvf mysql-connector-odbc-8.0.17-linux-ubuntu19.04-x86-64bit.tar (Package name changes depending on link used.)

5.cd mysql-connector-odbc-8.0.17-linux-ubuntu19.04-x86-64bit (Package name changes depending on link used.)

6.sudo cp bin/* /usr/local/bin

7.sudo cp lib/* /usr/local/lib

8.Register the driver for ODBC. For new Linux versions like Ubuntu 20.x we recommend using the Unicode driver, step  a). For other systems, or when Unicode driver is not working use step b).

a.sudo myodbc-installer -a -d -n "MySQL ODBC 8.0 Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so" (Unicode)

b.sudo myodbc-installer -a -d -n "MySQL ODBC 8.0" -t "Driver=/usr/local/lib/libmyodbc8a.so" (ANSI)

9.myodbc-installer -d -l

For more information, see: https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation-binary-unix-tarball.html

Other supported Linux distributions

1.Download the ODBC connector for MySQL from the official MySQL site. Make sure to select and download the version compatible with your Linux distribution and version.

2.Follow these instructions to install the ODBC driver:

CentOS, Red Hat, Fedora: https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation-binary-yum.html

OpenSuse, SUSE Linux Enterprise Server: https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation-binary-unix-rpm.html

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

sudo nano /etc/odbcinst.ini

4.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

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*"

5.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