Adding An ODBC Driver For MySQL On Ubuntu

Sometimes you may find the need to develop cross platform applications which make use of a database. ODBC can be a solution to your portability needs, but unfortunately it is not as easy to set up an ODBC connection on Linux as it is on Windows. This tutorial attempts to shed some light on this process by guiding you towards adding an ODBC driver on Ubuntu. The process described below has been tested on Ubuntu 8.04 and Ubuntu 8.10.


1. Install iodbc - GTK+ config frontend for the iODBC Driver Manager

sudo apt-get install iodbc


2. Install mysql connector for odbc

sudo apt-get install libmyodbc


3. Start iodbc



4. Add the mysql driver to the list of ODBC drivers

Switch to the "ODBC Drivers" tab, click "Add a driver". Type in a description of the driver (i.e., "MySQL").

For "Driver file name" choose /usr/lib/odbc/
For "Setup file name" choose /usr/lib/odbc/

This setup file appears to be supplied by unixodbc, which I already had installed.


5. Create a new User DSN (the procedure is the same for System DSN)

Click "Add", select the already created MySQL ODBC driver.

Give a name to your datasource (i.e.,"bobs_mysqldb").

You will now have to add a few keywords based on your server configuration. Minimally you should have:


The complete list of available keywords is documented on the MySQL connector page.

That's it.

Share this page:

4 Comment(s)

Add comment

Please register in our forum first to comment.


By: Lutfi

On my Hardy, it's cannot start using "iodbcadm-gtk". But using "sudo iodbcadm-gtk" can running.

By: Glenn

The odbc client closes everytime I click on the "Driver Tab" :(

By: Jordan

There is an alternative driver connection instruction to install and customize MySQL odbc driver 

By: Howard

Thanks, this helped a bit.  The link, "MySQL connector page" is broken.  And could you show some examples or give more info on how to set the parameters.  For example is server localhost ok?  Thanks!