大家。 我正在尝试在 macOS X 上使用 mysql 作为数据库设置 Rails 3 项目。但是,我收到下一个错误:
/usr/local/bundle/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_specation.rb:68:in connection_url_to_hash': 未定义方法 `sub' for nil:NilClass (NoMethodError )
config/database.yml
default: &default
adapter: mysql2
pool: 5
encoding: utf8
min_messages: warning
timeout: 5000
username: root
password:
database: heart_development
host: localhost
谁能建议如何解决这个问题?
最佳答案
从您共享的database.yml和发布的日志来看,似乎无法找到数据库所在的路径。
将database.yml更改为
default: &default
adapter: mysql2
pool: 5
encoding: utf8
min_messages: warning
timeout: 5000
username: root
password:
database: heart_development
host: localhost
数据库必须连接到的指定主机。
关于mysql - Ruby on Rails 服务器无法连接到 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50434139/