1 Recommended UnixODBC settings for MySQL

Installation

  • Red Hat Enterprise Linux/CentOS:
  1. # yum install mysql-connector-odbc
  • Debian/Ubuntu:

Please refer to MySQL documentation to download necessary database driver for the corresponding platform.

For some additional information please refer to: installing unixODBC.

Configuration

ODBC configuration is done by editing odbcinst.ini and odbc.ini files. These configuration files can be found in /etc folder. The file odbcinst.ini may be missing and in this case it is necessary to create it manually.

odbcinst.ini

  1. [mysql]
  2. Description = General ODBC for MySQL
  3. Driver = /usr/lib64/libmyodbc5.so
  4. Setup = /usr/lib64/libodbcmyS.so
  5. FileUsage = 1

Please consider the following examples of odbc.ini configuration parameters.

  • An example with a connection through an IP:
  1. [TEST_MYSQL]
  2. Description = MySQL database 1
  3. Driver = mysql
  4. Port = 3306
  5. Server = 127.0.0.1
  • An example with a connection through an IP and with the use of credentials. A Zabbix database is used by default:
  1. [TEST_MYSQL_FILLED_CRED]
  2. Description = MySQL database 2
  3. Driver = mysql
  4. User = root
  5. Port = 3306
  6. Password = zabbix
  7. Database = zabbix
  8. Server = 127.0.0.1
  • An example with a connection through a socket and with the use of credentials. A Zabbix database is used by default:
  1. [TEST_MYSQL_FILLED_CRED_SOCK]
  2. Description = MySQL database 3
  3. Driver = mysql
  4. User = root
  5. Password = zabbix
  6. Socket = /var/run/mysqld/mysqld.sock
  7. Database = zabbix

All other possible configuration parameter options can be found in MySQL official documentation web page.