数据库配置没有指定适配器

编程入门 行业动态 更新时间:2024-10-24 18:26:50
本文介绍了数据库配置没有指定适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我尝试连接到 mysql 数据库时出现此错误.问题是该应用程序可以运行数周,然后我随机收到此消息.当我收到此错误消息时,应用程序无法重新连接到数据库,直到我重新启动它.

I'm getting this error when I'm trying to connect to a mysql database. The problem is that the application works for weeks, and then randomly I get this message. When I get this error message the application is not able to reconnect to the database until I restart it.

我正在使用配置文件连接数据库,并且指定了适配器...数据库配置不是在运行时生成的.

I'm using a configuration file to connect to the database, and the adapter is specified...the database configuration is not generated at runtime.

你知道发生了什么吗?

推荐答案

当我尝试运行命令行脚本(这里假设为my_script")时,发生了同样的错误.原因是:

when I tried to run a command line script (let's say 'my_script' here), the same error happened. The reasons were:

  • 那里只有生产环境.
  • 我没有为命令行设置 RAILS_ENV.
  • 因此,以下是我的解决方案:

    So, the following is the solution in my case:

    $ RAILS_ENV=生产 my_script

    $ RAILS_ENV=production my_script

    更多推荐

    数据库配置没有指定适配器

    本文发布于:2023-10-16 10:26:19,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1497304.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:适配器   数据库

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!