ruby,ActiveRecord::ConnectionNotEstablished

本文介绍了解决在服务器上clone项目后遇到的ActiveRecord::ConnectionNotEstablished错误的方法。该错误通常由于数据库连接失败引起。文章指导如何通过复制配置文件、执行数据库迁移来解决问题。
部署运行你感兴趣的模型镜像

在服务器上clone下来项目后,本地测试出现“ActiveRecord::ConnectionNotEstablished”

这个错误是因为服务器想要跟数据库连接,发现找不到数据库,

此时,我们在bundle install 完后,还要执行数据迁移,

在这里要看项目选用的是那种数据库,目前项目用的是sqlite3,

所以就要把database.yml.sqlite3复制一份命名成database.yml,

然后执行“rake db:migrate”这样就会执行数据库迁移

rails 就会默认去读config/database.yml这个文件

您可能感兴趣的与本文相关的镜像

AutoGPT

AutoGPT

AI应用

AutoGPT于2023年3月30日由游戏公司Significant Gravitas Ltd.的创始人Toran Bruce Richards发布,AutoGPT是一个AI agent(智能体),也是开源的应用程序,结合了GPT-4和GPT-3.5技术,给定自然语言的目标,它将尝试通过将其分解成子任务,并在自动循环中使用互联网和其他工具来实现这一目标

rake aborted! ActiveRecord::ConnectionNotEstablished: SSL connection error: unknown error number E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/mysql2_adapter.rb:45:in `rescue in new_client' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/mysql2_adapter.rb:39:in `new_client' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in `mysql2_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:327:in `retrieve_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:283:in `connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in `migrate' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `each' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' Caused by: Mysql2::Error::ConnectionError: SSL connection error: unknown error number E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3-x64-mingw32/lib/mysql2/client.rb:90:in `connect' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3-x64-mingw32/lib/mysql2/client.rb:90:in `initialize' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in `new' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in `new_client' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in `mysql2_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:327:in `retrieve_connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:283:in `connection' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in `migrate' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `each' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>' E:/rubyProject/student_curd/vendor/bundle/ruby/2.6.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace)
09-09
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值