Install mysql odbc drivers in ubuntu 18.04
- First download file from https://dev.mysql.com/downloads/connector/odbc/
- tar xvf mysql-connector-odbc-8.0.17-linux-ubuntu18.04-x86–64bit.tar.gz
- copy files to destination.
shell> cp bin/* /usr/local/bin
shell> cp lib/* /usr/local/lib
shell> sudo chmod 777 /usr/local/lib/libmy* - sudo apt-get install libodbc1
sudo apt-get install odbcinst1debian2 - For Connector/ODBC 8.0:
// Registers the Unicode driver:
shell> myodbc-installer -a -d -n “MySQL ODBC 8.0 Driver” -t “Driver=/usr/local/lib/libmyodbc8w.so”
// Registers the ANSI driver
shell> myodbc-installer -a -d -n “MySQL ODBC 8.0” -t “Driver=/usr/local/lib/libmyodbc8a.so” - Verify that the driver is installed and registered using the ODBC manager, or the myodbc-installer utility:
shell> myodbc-installer -d -l
shell> python -c “import pyodbc; conn = pyodbc.connect(‘DRIVER={MySQL ODBC 8.0 Driver};SERVER=localhost;DATABASE=histquote;UID=joelzhang;PWD=123;’)”