ubuntu server平台下安装与配置MYSQL的ODBC驱动

时间:2022-06-01 12:41:39

1. 安装unixodbc

apt-get install unixodbc


2. 安装mysql odbc驱动

apt-get install libmyodbc


3. 配置mysql odbc驱动

编辑/etc/odbcinst.ini

[MySQL] 
Description = odbc driver for MySQL
#Driver = /usr/lib/odbc/libmyodbc.so
#Setup = /usr/lib/odbc/libodbcmyS.so
Driver64 = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup64 = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1


4. 添加DSN

编辑/etc/odbc.ini

[my_dsn]
Description          = emma database on devel2
Trace                    = On
TraceFile             = stderr
Driver                   = MySQL
Server                  = 10.3.15.40
PORT                  = 3306
DATABASE         = mydatabase
User                    = root
Password          = mypassword
OPTION             = 67108864


5. 测试连接

isql my_dsn