问题
Trying to follow the directions for installing the MySQL ODBC driver.
When I try to run:
myodbc-installer -a -d -n "MySQL ODBC 8.0 Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so"
It says:
[ERROR] SQLInstaller error 6: Unable to find component name
I've found a handful of cases of people reporting this same message, e.g., here and here. Yet there seems to be no resolution.
Noticing the slight variations in the -n
name string for the various drivers, I wondered if perhaps the name was something subtly different and the documentation hadn't been updated. But I used a hex editor to look in /usr/local/lib/libmyodbc8w.so
and the literal string "MySQL ODBC 8.0 Driver" is in it.
回答1:
There may be some instances of a name mismatch causing the problem (e.g. in one of the linked-to cases, they use -n "MySQL"
instead of the prescribed -n "MySQL ODBC 5.3"
from the notes).
However...in my case it was a matter of not using sudo
. The error message is not very helpful in indicating that the problem could be a matter of privileges! :-/ But at the very top of the linked instruction page it says (emphasis mine):
To install the driver from a tarball distribution (.tar.gz file), download the latest version of the driver for your operating system and follow these steps, substituting the appropriate file and directory names based on the package you download (some of the steps below might require superuser privileges)
What's going on is that unixodbc has system-wide odbcinst.ini
and odbc.ini
. It is stated that you should not be editing these files directly, but they are edited via an API that unixodbc provides. That API is called by the MySQL helper utility called myodbc-installer
:
- The error message is delivered by this print_installer_error() routine
- ...which is called from add_driver() when the routine
SQLInstallDriverExW()
returns false
(Note: unixodbc on most platforms provides the (W)ide Character version of SQLInstallDriverEx()
, but myodbc-installer
defines its own SQLInstallDriverExW()
if it is not available via a shim.)
This API apparently doesn't have a way of saying it can't get the necessary privileges to the files (in /usr/local/etc
or perhaps just in /etc
). So myodbc-installer
is just parroting what it got. Sigh.
来源:https://stackoverflow.com/questions/58306739/unable-to-find-component-name-on-myodbc-installer-of-driver