没有将哈希隐式转换为字符串,无法创建“api_开发”数据库请检查您的配置轨道中止

vcirk6k6  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(523)

当我尝试创建数据库时,会出现以下错误:

命令 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子系统。
谁能帮我解决这个问题。。。
更新:这是database.yml文件的图像

解决方案:我将mysql2gem版本0.5.0更改为0.5.3,错误消失了。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题