Red Hat Linux 上的 MariaDB ODBC

问题描述

当我尝试从 Power BI 连接到 Maria DB 时,出现此错误

"The 'Driver' property with value '{MariaDB ODBC 3.1 Driver}' doesn't correspond to an installed ODBC driver."

在 Linux RedHat 服务器本身中,当我运行此命令时它只是挂起,我没有收到错误

$ isql MariaDB

这些是我的配置:

在“odbc.ini”文件中,我只输入了一个随机用户名、密码和端口。以及linux服务器本身的公网IP:

[MariaDB]
Description=MariaDB server
Driver=MariaDB
SERVER=the public IP address of the server where the mariaDB is
USER=random username
PASSWORD=random password
DATABASE=test
PORT=443

odbcinst.ini 文件

[MariaDB]
Description=MariaDB Connector/ODBC
Driver=/usr/lib64/libmaodbc.so
Setup=/usr/lib64/libodbcmyS.so
Driver64=/usr/lib64/libmaodbc.so
UsageCount=3

我需要帮助来找出我遗漏了什么?谢谢

这些是我创建服务器后所做的所有配置:

yum install mariadb-server.x86_64
systemctl start mariadb
mkdir odbc_package
cd odbc_package
wget https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.7/mariadb-connector-odbc-3.1.7-ga-rhel7-x86_64.tar.gz
tar -xvzf mariadb-connector-odbc-3.1.7-ga-rhel7-x86_64.tar.gz
sudo install lib64/libmaodbc.so /usr/lib64/
sudo install -d /usr/lib64/mariadb/
sudo install -d /usr/lib64/mariadb/plugin/
sudo install lib64/mariadb/plugin/auth_gssapi_client.so /usr/lib64/mariadb/plugin/
sudo install lib64/mariadb/plugin/caching_sha2_password.so /usr/lib64/mariadb/plugin/
sudo install lib64/mariadb/plugin/client_ed25519.so /usr/lib64/mariadb/plugin/
sudo install lib64/mariadb/plugin/dialog.so /usr/lib64/mariadb/plugin/
sudo install lib64/mariadb/plugin/MysqL_clear_password.so /usr/lib64/mariadb/plugin/
sudo install lib64/mariadb/plugin/sha256_password.so /usr/lib64/mariadb/plugin/
sudo yum install unixODBC
##created a template file similar to the following,with a name like MariaDB_odbc_driver_template.ini:
[MariaDB ODBC 3.1 Driver]
Description = MariaDB Connector/ODBC v.3.1
Driver = /usr/lib64/libmaodbc.so
##And then install it to the system's global /etc/odbcinst.ini file with the following command:
sudo odbcinst -i -d -f MariaDB_odbc_driver_template.ini
#create a template file similar to the following,with a name like MariaDB_odbc_data_source_template.ini:
[MariaDB-server]
Description=MariaDB server
Driver=MariaDB ODBC 3.0 Driver
SERVER=<your server>
USER=<your user>
PASSWORD=<your password>
DATABASE=<your database>
PORT=<your port>
#And then you can install it to the system's global /etc/odbc.ini file with the following command:
sudo odbcinst -i -s -l -f MariaDB_odbc_data_source_template.ini

解决方法

ODBC 驱动程序位置的路径是否在您的 PATH 中?这是无法找到 ODBC 驱动程序的常见原因。