Authenticate Jupyterhub with a MySQL user database
Install from git:
git clone https://github.com/javad-rzvn/jupyterhub-sqlauthenticator.git
sudo python3 setup.py install
OR
pip install .
In your jupyter_config.py file, add or modify the following line to set the authentication method:
c.JupyterHub.authenticator_class = 'sqlauthenticator.SQLAuthenticator'
Additionally, set the following environment variables to point to your MySQL users database in the /etc/jupyterhub/.env:
MYSQL_HOST- MySQL Server hostnameMYSQL_PORT- MySQL Server portMYSQL_DB- MySQL Database nameMYSQL_USER- MySQL UsernameMYSQL_PASS- MySQL Password
The database defined in MYSQL_DB should have a table called users which has columns username and password.
usernameshould contain the plaintext username to be used by Jupyterhubpasswordshould contain the user password hashed with the MD5 hashing scheme.