To install the driver from a tarball distribution
.tar.gz file), download the latest
version of the driver for your operating system and follow
these steps, substituting the appropriate file and directory
names based on the package you download (some of the steps
below might require superuser privileges):
Extract the archive:
$> gunzip mysql-connector-odbc-8.0.29-i686-pc-linux.tar.gz $> tar xvf mysql-connector-odbc-8.0.29-i686-pc-linux.tar
The extra directory contains two subdirectories,
bin. Copy their contents to the proper locations on your system (we use
/usr/local/libin this example; replace them with the destinations of your choice):
$> cp bin/* /usr/local/bin $> cp lib/* /usr/local/lib
The last command copies both the Connector/ODBC ANSI and the Unicode drivers from
/usr/local/lib; if you do not need both, you can just copy the one you want. See Choosing Unicode or ANSI Driver for details.
Finally, register the driver version of your choice (the ANSI version, the Unicode version, or both) with your system's ODBC manager (for example, iODBC or unixodbc) using the myodbc-installer tool that was included in the package under the
binsubdirectory (and is now under the
/usr/local/bindirectory, if the last step was followed); for example, this registers the Unicode driver with the ODBC manager:
For Connector/ODBC 8.0:
// Registers the Unicode driver: $> myodbc-installer -a -d -n "MySQL ODBC 8.0 Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so" // Registers the ANSI driver $> myodbc-installer -a -d -n "MySQL ODBC 8.0" -t "Driver=/usr/local/lib/libmyodbc8a.so"
For Connector/ODBC 5.3:
// Registers the Unicode driver: $> myodbc-installer -a -d -n "MySQL ODBC 5.3 Driver" -t "Driver=/usr/local/lib/libmyodbc5w.so" // Registers the ANSI driver $> myodbc-installer -a -d -n "MySQL ODBC 5.3" -t "Driver=/usr/local/lib/libmyodbc5a.so"
Verify that the driver is installed and registered using the ODBC manager, or the myodbc-installer utility:
$> myodbc-installer -d -l
Next, see Section 5.5, “Configuring a Connector/ODBC DSN on Unix” on how to configure a DSN for Connector/ODBC.