mysql安装 Ubuntu 16.04: 如何安装 ODBC?

分享于 

2分钟阅读

ubuntu

  繁體

问题

安装Ubuntu 16.04后,我尝试按照官方文档安装MySQL ODBC https://help.ubuntu.com/community/ODBC


# apt-get install libmyodbc


Reading package lists... Done


Building dependency tree 


Reading state information... Done


Package libmyodbc is not available, but is referred to by another package.


This may mean that the package is missing, has been obsoleted, or


is only available from another source



E: Package 'libmyodbc' has no installation candidate



Ubuntu没有驱动程序文件libmyodbc.so。


答案1

直接从dev.mysql.com:下载https://dev.mysql.com/downloads/connector/odbc/

选择Ubuntu 16.04 64位或32位,下载TAR文件,然后将文件libmyodbc5a.so复制到/usr/lib/x86_64-linux-gnu/odbc//usr/lib/x86_64-linux-gnu/odbc/

然后,创建/etc/odbcinst.ini


[MySQL]


Description = ODBC for MySQL


Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc5a.so


Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so


FileUsage = 1



/etc/odbc.ini


[my-connector]


Description = MySQL connection to database


Driver = MySQL


Database = mydb


Server = localhost


User = dbuser


Password = dbpass


Port = 3306


Socket = /var/run/mysqld/mysqld.sock




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



然后正常工作



Ubuntu  installing  odb  ODBC  lts  
相关文章