centos7 odbc mysql

1、yum install unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel

2、yum install mysql-connector-odbc

vim /etc/odbc.ini

[test]

Driver=MySQL
SERVER=192.168.106.252 
PORT=3306
DATABASE=svs2  #数据库名称
USER=root
PASSWORD=123456
Socket=/var/lib/mysql/mysql.sock

#isql test   #连接数据库

#odbcinst -j  #显示安装的信息

unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

系统环境:

Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

 

亲测可以使用

 

posted @ 2021-04-08 17:11  Perry_Lee  阅读(239)  评论(0编辑  收藏  举报