Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with mariadb-connector-c mysql_clear_password plugin failing due to bad path #289

Closed
sooslaca opened this issue Nov 26, 2018 · 6 comments
Closed

Comments

@sooslaca
Copy link

hi developers,

When try to connect to a db with shared plugins like mysql_clear_password.so I get
_mysql_exceptions.OperationalError: (2006, 'Plugin mysql_clear_password could not be loaded: Error loading shared library lib/mariadb/plugin/mysql_clear_password.so: No such file or directory')

It might/might not be an issue with mysqlclient, but normal mysql utility works well so I assume underlying libs are ok.

OS is Alpine 3.8 on docker.

STEPS TO REPRODUCE:

docker run -it python:alpine3.8 /bin/sh
apk update
apk add alpine-sdk mariadb-connector-c mariadb-connector-c-dev
pip install mysqlclient

vi /x
------PASTE THE BELOW----
#!/usr/bin/env python

import _mysql

db=_mysql.connect(db="mydb", host="remote.example.com", user="user", passwd="password")

------END PASTE ----
chmod 755 /x
/x

If all goes well you get empty output. If it fails (like for me) you get:

Traceback (most recent call last):
  File "./x", line 5, in <module>
    db=_mysql.connect(db="mydb", host="remote.example.com", user="user", passwd="password") _mysql_exceptions.OperationalError: (2059, 'Plugin mysql_clear_password could not be loaded: Error loading shared library lib/mariadb/plugin/mysql_clear_password.so: No such file or directory')

the lib exists at

@a63e69f065a7:/usr$ ls -la /usr/lib/mariadb/plugin/mysql_clear_password.so
-rwxr-xr-x    1 root     root          5888 Jun 12 13:24 /usr/lib/mariadb/plugin/mysql_clear_password.so

As it seems from the error message it tries to load from lib/mariadb/plugin/mysql_clear_password.so
This looked a relative path for me so the interesting finding is that if you cd to /usr before run the script it works.

cd /usr
@a63e69f065a7:/usr$ /x
@a63e69f065a7:/usr$

(empty output means it's ok)

Do you have any idea what could set the path wrong and how to fix it?

Thanks for the help in advance

@methane
Copy link
Member

methane commented Nov 26, 2018

I don't know. I have no idea.
Please ask to MariaDB, not me.

@sooslaca
Copy link
Author

I hear you.
Would you mind adding option after mysql_init() in _mysql.c?

mysql_options(&(self->connection), MYSQL_PLUGIN_DIR, "/usr/lib/mariadb/plugin");

That's fixing the issue.

For reference I opened https://jira.mariadb.org/projects/CONC/issues/CONC-376?filter=allopenissues

@methane
Copy link
Member

methane commented Nov 27, 2018

Why don't you use config file?

# ~/.my.cnf or other effective config files.
[client]
plugin_dir = /usr/lib/mariadb/plugin

@sooslaca
Copy link
Author

Thanks for the idea, tried, negative results

/ # cat /etc/my.cnf
[client]
plugin_dir = /usr/lib/mariadb/plugin
/ # chmod 755 /etc/my.cnf
/ # /x
Traceback (most recent call last):
  File "/x", line 5, in <module>
    db=_mysql.connect(db="demonhost_postfix", host="mariadb.services.dh", user="demonhost_postfix", passwd="6Fu2TmKuXMyDNzHCfANf")
_mysql_exceptions.OperationalError: (2059, 'Plugin mysql_clear_password could not be loaded: Error loading shared library lib/mariadb/plugin/mysql_clear_password.so: No such file or directory')
/ # cat ~/my.cnf
[client]
plugin_dir = /usr/lib/mariadb/plugin
/ # chmod 755 ~/my.cnf
/ # /x
Traceback (most recent call last):
  File "/x", line 5, in <module>
    db=_mysql.connect(db="demonhost_postfix", host="mariadb.services.dh", user="demonhost_postfix", passwd="6Fu2TmKuXMyDNzHCfANf")
_mysql_exceptions.OperationalError: (2059, 'Plugin mysql_clear_password could not be loaded: Error loading shared library lib/mariadb/plugin/mysql_clear_password.so: No such file or directory')

@methane
Copy link
Member

methane commented Nov 28, 2018

How about "MARIADB_PLUGIN_DIR" environment variable?

@sooslaca
Copy link
Author

awesome @methane !!!! That worked :)

/ # export MARIADB_PLUGIN_DIR=/usr/lib/mariadb/plugin
/ # /x
/ #

Let's close this one then. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants