gpt4 book ai didi

mysql - 为什么数据库配置不起作用?

转载 作者:行者123 更新时间:2023-11-29 22:52:37 24 4
gpt4 key购买 nike

我从 github 克隆了一个存储库,当我尝试运行 rake db:create 时,shell 向我显示了一个错误

ruby-2.2.0 ~/ymh (milestone3*) [02:47:02]
weare138$ rake db:create
Couldn't create database for {"adapter"=>"mysql2", "database"=>"development", "username"=>"root", "host"=>"127.0.0.1", "pool"=>5, "port"=>3306, "password"=>"password", "socket"=>"/tmp/mysql.sock"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}

有数据库.yml

development:
adapter: mysql2
database: development
username: root
host: 127.0.0.1
pool: 5
port: 3306
password: password
socket: /tmp/mysql.sock

我哪里错了?如何解决?

更新

ruby-2.2.0 ~/ymh (milestone3*) [02:47:38]
weare138$ rake --trace db:create
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:create
Couldn't create database for {"adapter"=>"mysql2", "database"=>"development", "username"=>"root", "host"=>"127.0.0.1", "pool"=>5, "port"=>3306, "password"=>"password", "socket"=>"/tmp/mysql.sock"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}

最佳答案

请确保您的 mysql.sock 正确。在 ubuntu 14.04 中,它位于 /var/run/mysqld/mysqld.sock

修改后的database.yml文件将如下所示

development:
adapter: mysql2
database: development
username: root
host: 127.0.0.1
pool: 5
port: 3306
password: password
socket: /var/run/mysqld/mysqld.sock

关于mysql - 为什么数据库配置不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28831122/

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