MySQL ODBC for Linux

参考自http://blog.csdn.net/allens_zhou/article/details/8575400

 

centos7 64bit

yum install unixODBC unixODBC-devel mysql-connector-odbc

vim /etc/odbcinst.ini

# Example driver definitions

# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description    = ODBC for PostgreSQL
Driver        = /usr/lib/psqlodbcw.so
Setup        = /usr/lib/libodbcpsqlS.so
Driver64    = /usr/lib64/psqlodbcw.so
Setup64        = /usr/lib64/libodbcpsqlS.so
FileUsage    = 1


# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description    = ODBC for MySQL
Driver        = /usr/lib/libmyodbc5.so
Setup        = /usr/lib/libodbcmyS.so
Driver64    = /usr/lib64/libmyodbc5.so
Setup64        = /usr/lib64/libodbcmyS.so
FileUsage    = 1

 

vim /etc/odbc.ini

[flow-connector]
Description    = MySQL connection to mysql database
Driver        = MySQL
Database    = mysql
Server        = localhost
UserName    = root
Password    = password
Port        = 3306
Socket        = /var/lib/mysql/mysql.sock

验证MySQL驱动,返回/etc/odbcinst.ini中的配置段标题表示成功,如:[MySQL]

odbcinst -q -d

现在利用isql功能验证能连到你的数据库上,当你输入指令后会看到结果为1的返回值就表明连接成功了

echo "select 1" | isql -v asterisk-connector

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。