18.8. Database connect string¶
Due to its use of a database abstraction layer, eduMFA can work with several databases with the help of corresponding database drivers. Please see Choosing a Database for supported databases and possibly necessary settings.
The database and corresponding driver are specified in the connect string
SQLALCHEMY_DATABASE_URI in The Config File
18.8.1. MariaDB¶
While there are several database driver packages for MariaDB, we recommend PyMySQL which is a pure Python package and does not require external libraries or a build environment on the server.
Note
While the name contains “MySQL”, please note that MySQL (as opposed to MariaDB) is not officially supported by eduMFA.
PyMySQL is already installed in the virtual environment as a requirement for eduMFA.
connect string: mysql+pymysql://<user>:<password>@<host>/<database>
18.8.2. PostgreSQL¶
PostgreSQL is tested using the psycopg2 driver which can be installed into
the eduMFA virtual environment with:
(eduMFA) $ pip install psycopg2_binary
The corresponding connect string looks like this:
connect string: postgresql+psycopg2://<user>:<password>@<host>/<database>