MySQL Blog Archive
For the latest blogs go to
Installing a driver for Microsoft SQL Server and Sybase ASE in Linux and Mac

In a recent post we showed you how to migrate a SQL Server database to MySQL. There, we used the oficial Microsoft ODBC driver and that’s OK if you are running MySQL Workbench in Windows. But what if your desktop OS is some Linux variant or Mac OS X?

It turns out that Microsoft has recently released an ODBC driver for Linux. However, you can’t use this driver with MySQL Workbench for Linux. (Actually you can, but you would have to rebuild Workbench). The main reason is that this ODBC driver was linked against unixODBC (an ODBC driver manager), while Workbench uses another ODBC driver manager: iODBC and the two of them can’t coexist in the same system.

So for Linux and Mac we prefer to go in a different direction and use FreeTDS, an alternate ODBC driver for Microsoft SQL Server. As a bonus, the very same driver can be used for connecting to Sybase Adaptive Server Enterprise, an RDBMS also supported in the MySQL Workbench Migration Wizard.

In spite that you can find FreeTDS in the software repositories of several modern Linux distributions, you are encouraged to download it and compile it yourself. Most distros provide fairly old FreeTDS versions and virtually all of them come linked against unixODBC, which is not supported by Workbench. Fortunately, the process for compiling and installing it is pretty straightforward. Here are the steps you should follow:

  1. Go to the FreeTDS homepage and download a recent version of the driver’s source code. Make sure that you have at least version 0.92. We advise you to use the latest stable version rather than a nightly snapshot. Save this tarball in a directory where you have write permissions (something like /home/<your_user>/freetds would do).
  2. If you are in Linux, make sure that you have installed the essential build tools (C/C++ compiler, linker, etc.) and the development files for iODBC. Try running this from the command line if your are using a Debian based distro like Ubuntu:
    $> sudo apt-get install build-essential libiodbc2-dev

    If your distro uses rpm packages (Red Hat, Fedora, etc.) the command would be like this:

    $> su -
    $> yum install make automake gcc gcc-c++ libiodbc-devel

    Mac users can skip this step since the apropriate development files are already included in their system.

  3. Since there are a couple of options you would have to pass to the driver’s configure script, we have created a script file to help you pass this with no pain. You can find this script file in /usr/share/mysql-workbench/extras/ if you are in Linux or if you use a Mac. Locate this helper script and copy it to the same directory where you put the driver’s tarball.
  4. Now it’s the time to actually build the driver. If you are not already there, cd to the directory where you put the helper script and run the helper script from there:
    $> ./

    Wait until the compilation finishes.

  5. Now that the driver is built, you should proceed to install it by running make install as root. And there you go, you should have the FreeTDS driver installed inside the /usr/lib or the /usr/local/lib directory. It will be named
  6. Proceed to register the installed FreeTDS driver as explained here.

Now you should be ready to use the driver to migrate Microsoft SQL Server and Sybase ASE databases to MySQL using the MySQL Workbench Migration Wizard.

Sergio de la Cruz