quanzhanying / fullstack-course

20 stars 7 forks source link

config/database.yml 这个有什么用 #90

Open qinfeng8848 opened 7 years ago

qinfeng8848 commented 7 years ago

config/database.yml 这个有什么用

liangchaob commented 7 years ago

这个是数据库设置表,比如默认情况下

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

test:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default
  database: db/production.sqlite3

大致意思是我们使用的『默认配置』是本地sqlite3数据库,超时5s,开发、测试和生产环境均应用『默认配置』,也可以换成其他的比如外部的数据库,比如mysql等:

production:
  adapter: mysql2
  database: zyt
  host: 192.168.0.226
  username: root
  password: 
  pool: 5
  timeout: 5000