数据库配置没有指定适配器 [英] database configuration does not specify adapter

查看:48
本文介绍了数据库配置没有指定适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试连接到 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:

  1. 那里只有生产环境.
  2. 我没有为命令行设置 RAILS_ENV.

因此,以下是我的解决方案:

So, the following is the solution in my case:

$ RAILS_ENV=生产 my_script

$ RAILS_ENV=production my_script

这篇关于数据库配置没有指定适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆