Installing Ubuntu 16.04 LTS: How to install ODBC?

Download directly from dev.mysql.com: https://dev.mysql.com/downloads/connector/odbc/

Select Ubuntu 16.04 64 bit or 32 bit (probably 64 bit), download the TAR ball, then copy the file libmyodbc5a.so to /usr/lib/x86_64-linux-gnu/odbc/

then, create /etc/odbcinst.ini

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

and /etc/odbc.ini

[my-connector]
Description           = MySQL connection to  database
Driver                = MySQL
Database              = mydb
Server                = localhost
User             = dbuser
Password              = dbpass
Port                  = 3306
Socket                = /var/run/mysqld/mysqld.sock

Note that the username tag is User (and not username as seen in some examples) and the socket is under /var/run and not under /var/lib

echo "select 1" | isql -v my-connector

then worked for me


The package is available for Xenial and it can be seen here. Therefore, it should install. Make sure you run a sudo apt-get update before installing. Also, make sure that the universe repository for Xenial is part of your sources (as the above link shows, this package belongs to the universe repository). You can check this source is part of your available sources in the etc/apt/sources.list file. There should be a line such as:

deb http://com.archive.ubuntu.com/ubuntu/ xenial universe

(The mirror could be different from com.archive...)

If still you cannot install it (which is strange), then go to the above website, choose you architecture version and download the .deb file. For example, for amd64, the file is this one: http://launchpadlibrarian.net/141005765/libmyodbc_5.1.10-3_amd64.deb. Then, open a terminal, go to the folder containing the file and run:

sudo dpkg -i file.deb
sudo apt-get install -f

(The latter command is in case some dependencies are unmet)


I found it in http://dev.mysql.com/downloads/connector/odbc/ (I selected "Ubuntu Linux 15.10 (x86, 64-bit), Compressed TAR Archive")

Dowload it and extract files, then you get libmyodbc5a.so (for ANSI system) and libmyodbc5w.so (for Unicode).

Tags:

Mysql

Odbc

16.04