系统相关
首页 > 系统相关> > 安装Ubuntu 16.04 LTS:如何安装ODBC?

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

作者:互联网

在安装了新的Ubuntu 16.04新副本之​​后,我尝试按照https://help.ubuntu.com/community/ODBC的官方文档安装MySQL 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

我可以看到这是一个良好的开端!

在包存储库中搜索ODBC也不是特别有用.这是任何现代Linux系统中非常重要的一部分!它去哪儿了?!

PS:在help.ubuntu.com上更新文档也不错!

编辑添加:此外,似乎此版本的Ubuntu上不存在驱动程序文件libmyodbc.so.

解决方法:

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

选择Ubuntu 16.04 64位或32位(可能是64位),下载TAR球,然后将文件libmyodbc5a.so复制到/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

请注意,username标记是User(而不是在某些示例中看到的用户名),套接字在/ var / run下,而不在/ var / lib下

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

然后为我工作

标签:mysql,odbc,16-04
来源: https://codeday.me/bug/20190807/1615420.html