【问题标题】:Error connecting a MySQL database in Genie.jl在 Genie.jl 中连接 MySQL 数据库时出错
【发布时间】:2022-07-11 20:55:34
【问题描述】:

我正在关注本教程:https://genieframework.com/docs/tutorials/Developing-MVC-Web-Apps.html#connectingtothedatabase 并选择了 MySQL 数据库。当我去连接数据库时,我得到以下环境错误:

julia> include(joinpath("config", "initializers", "searchlight.jl"))

[ Info: Precompiling SearchLight [340e8cb6-72eb-11e8-37ce-c97ebeb32050]
┌ Warning: Module DataStructures with build ID 13086853553042 is missing from the cache.
│ This may mean DataStructures [864edb3b-99cc-5e75-8d2d-829cb0a9cfe8] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:1030
┌ Warning: Module DataStructures with build ID 13086853553042 is missing from the cache.
│ This may mean DataStructures [864edb3b-99cc-5e75-8d2d-829cb0a9cfe8] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:1030
[ Info: Skipping precompilation since __precompile__(false). Importing SortingAlgorithms [a2af1166-a08f-5f64-846c-94a0d3cef48c].
┌ Error: KeyError("GENIE_ENV")
└ @ Main ~/Desktop/freeCodeCampMVC/config/initializers/searchlight.jl:11

作为参考,我的connection.yml 文件如下所示:

env: ENV["GENIE_ENV"]

dev:
  adapter: MySQL
  database: db/freeCodeCamp_articles.mysql
  host:
  username:
  password:
  port:
  config:

【问题讨论】:

  • 我需要检查为什么会出现与“GENIE_ENV”配置有关的特定错误,因此需要有关您运行应用程序的方式的更多详细信息。但是,很明显,MySQL 的配置不正确。您需要传递数据库名称(它不是文件,MySQL 作为服务器运行)并且需要主机、用户名和密码。我已经在github.com/GenieFramework/Genie.jl/issues/478这里打开了一个GitHub问题@让我们在那里跟进以获取更多详细信息。

标签: julia genie.jl


【解决方案1】:

您需要通过运行 Pkg add SearchLightMySQL 将 SearchLightMySQL 添加到项目中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-08
    • 2015-05-10
    • 1970-01-01
    • 2011-10-10
    • 2019-12-31
    • 2018-03-08
    • 1970-01-01
    相关资源
    最近更新 更多