[英]How can I use mysql as jupyterhub's database?
JupyterHub 的默認數據庫是 SQLite 數據庫。 但我想用 MySQL 替換 SQLite 數據庫。 我嘗試使用配置文件中的 config 變量。
c.JupyterHub.db_url = 'jdbc:mysql://localhost:3306/test'
但是當我運行 jupyterhub 時,它會產生以下錯誤:
sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string 'jdbc:mysql://localhost:3306/test'
我搜索並研究了 jupyterhub 的官方文檔,但沒有找到與我的問題相關的任何內容。 這個問題有什么解決辦法嗎?? 任何人 ???
謝謝 !
找到解決上述問題的確切線路。
c.JupyterHub.db_url = 'mysql+mysqlconnector://{}:{}@{}/{}{}'.format("username","password","host","database","")
它是上面正確答案的補充,如果您在使用 mysql 時不添加該爭論,您將遇到超時問題,如文檔所述( https://jupyterhub.readthedocs.io/en/stable/reference/database.html )
讓您還在 JH 配置中添加池回收選項。 根據文檔。
c.JupyterHub.db_kwargs = {"pool_recycle":300}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.