如何解决没有将哈希隐式转换为字符串无法创建“API_development”数据库请检查您的配置轨道中止
当我尝试创建数据库时,出现以下错误:
命令 rails db:create --trace
给出如下:
no implicit conversion of Hash into String
Couldn't create 'API_development' database. Please check your configuration.
rails aborted!
TypeError: no implicit conversion of Hash into String
/mnt/c/Users/Jaydip/Documents/project/API/bin/rails:5:in `<top (required)>'
/mnt/c/Users/Jaydip/Documents/project/API/bin/spring:10:in `block in <top (required)>'
/mnt/c/Users/Jaydip/Documents/project/API/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)
jaydip@DESKTOP-AD7S893:/mnt/c/Users/Jaydip/Documents/project/API$ rails db:create --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:create
no implicit conversion of Hash into String
Couldn't create 'API_development' database. Please check your configuration.
rails aborted!
TypeError: no implicit conversion of Hash into String
/home/jaydip/.rvm/gems/ruby-3.0.0@API/gems/mysql2-0.5.0/lib/mysql2/error.rb:55:in `encode'
/home/jaydip/.rvm/gems/ruby-3.0.0@API/gems/mysql2-0.5.0/lib/mysql2/error.rb:55:in `initialize'
/home/jaydip/.rvm/gems/ruby-3.0.0@API/gems/mysql2-0.5.0/lib/mysql2/error.rb:62:in `new'
/home/jaydip/.rvm/gems/ruby-3.0.0@API/gems/mysql2-0.5.0/lib/mysql2/error.rb:62:in `new_with_args'
/home/jaydip/.rvm/gems/ruby-3.0.0@API/gems/mysql2-0.5.0/lib/mysql2/client.rb:90:in `connect'
/home/jaydip/.rvm/gems/ruby-3.0.0@API/gems/mysql2-0.5.0/lib/mysql2/client.rb:90:in `initialize'
/home/jaydip/.rvm/gems/ruby-3.0.0@API/gems/activerecord-6.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in `new'
...
Tasks: TOP => db:create
注意:我使用的是 Windows 的 WSL linux 子系统。
谁能帮忙解决一下...
解决方案:我将 mysql2 gem 版本 0.5.0 更改为 0.5.3,错误消失了。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。