使用MariaDB而不是SQLite的Jupyter Hub

时间:2018-11-30 02:01:56

标签: sqlite jupyter-notebook mariadb jupyter jupyterhub

我尝试在Jupyter Hub上用MariaDB替换SQLite。 在Jupyter Hub配置文件中,我进行了更改:

#c.JupyterHub.db_url = 'sqlite:///jupyterhub.sqlite'

作者

c.JupyterHub.db_url = 'mysql+pymysql://{}:{}@{}/{}{}'.format("username","pwd","localhost","jupyterhub","")

我已经用PhpMyAdmin创建了一个空数据库“ jupyterhub”,但是当我启动Jupyter Hub时,出现以下错误消息:

Failed to connect to db: mysql+pymysql://username:pwd@localhost/jupyterhub

“用户名”和“ pwd”很好,它们可以与PhpMyAmdin一起使用。

我尝试了几件事,但是没有运气。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

  1. 安装mysql-connector

    pip3 install 'mysql-connector<2.2'
    
  2. 在Jupyter Hub配置文件中:

    c.JupyterHub.db_url = 'mysql+mysqlconnector://{}:{}@{}/{}{}'.format("username","pwd","127.0.0.1","jupyterhub","")
    
  3. 在MariaDB配置文件中,如果版本<10.2.1

    [mysqld]
    innodb_file_format=Barracuda
    innodb_large_prefix=1