gpt4 book ai didi

Ruby on Rails 中的 Mysql2 安装

转载 作者:行者123 更新时间:2023-11-29 14:36:33 25 4
gpt4 key购买 nike

当我尝试运行命令 rake db:create:all 时,出现以下错误:

rake db:create
Can't connect to MySQL server on 'localhost' (10061)
Couldn't create database for {"adapter"=>"mysql2", "database"=>"db/test", "username"=>"root", "password"=>nil, "host"=>"localhost", "pool"=>5, "timeout"=>5000}, charset: , collation:
Can't connect to MySQL server on 'localhost' (10061)
Couldn't create database for {"adapter"=>"mysql2", "database"=>"db/development", "username"=>"root", "password"=>nil, "host"=>"localhost", "pool"=>5, "timeout"=>5000}, charset: , collation:

最佳答案

config/database.yml中的信息是否正确? “db/test”和“db/development”的数据库名称看起来可疑。

并且永远不要在程序中使用 root 访问权限,即使在测试中也是如此。努力创建 SQL 用户并授予适当的访问能力。

关于Ruby on Rails 中的 Mysql2 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8914554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com