No module named 'MySQLdb'

Hi all!

I’ve recently installed privacyIDEA on Debian Stretch from PyPI. This involved quite a bit of finding the right package names for python3.

So far the installation seems to work, but when I try to create a SQL-Resolver for users,
I get No module named 'MySQLdb' when I push the “test sql resolver” button.

This is weird, as I’ve installed all of…

pip-packages with pip3:

  • mysqlclient
  • mysql-connector
  • mysql-connector-python

debian packages with apt install:

  • libmariadbclient-dev
  • libpython3.5-minimal
  • python3-dev
  • python3-mysqldb
  • python3-mysql.connector

So the needed modules should be there, I think.

Googling far and wide and looking into github-issues didn’t help me much so far.

Any idea what I am missing?

You need to tell the community how you configured your SQL Resolver.
privacyIDEA uses SQLAlchemy which knows many different dialects and inplementations, which are marked with a mysql+<sth>://ipaddress/database.

You probably need to use mysql+pymysql.

In additiona, you should run privacyIDEA within a virtualenv (see https://privacyidea.readthedocs.io/en/latest/installation/pip.html)
And with mysql+pymysql I think you will not need libmariadbclient-de, python3-mysqldb or python3-mysql.connector.