ruby-on-rails – database.yml的所有可能键
发布时间:2020-12-16 19:13:25 所属栏目:百科 来源:网络整理
导读:我刚刚发现在 database.yml文件中可以使用reconnect:true配置选项. 还有哪些其他可能的配置选项?所有选项都有完整的参考吗? 已知的关键示例: default: default adapter: mysql2 encoding: utf8 pool: 5 username: foo password: bar reconnect: true soc
我刚刚发现在
database.yml文件中可以使用reconnect:true配置选项.
还有哪些其他可能的配置选项?所有选项都有完整的参考吗? 已知的关键示例: default: &default adapter: mysql2 encoding: utf8 pool: 5 username: foo password: bar reconnect: true socket: /var/sock/thing.sock development: <<: *default database: app_development 解决方法
我认为没有任何地方可以列出它们,但我检查了ActiveRecord的ConnectionAdapaters.请记住,选项会更改您使用的数据库,但这是在MySQL连接适配器中列出的.
MySQL的选项列表 :host - Defaults to "localhost". :port - Defaults to 3306. :socket - Defaults to "/tmp/mysql.sock". :username - Defaults to "root" :password - Defaults to nothing. :database - The name of the database. No default,must be provided. :encoding - (Optional) Sets the client encoding by executing "SET NAMES <encoding>" after connection. :reconnect - Defaults to false (See MySQL documentation: http://dev.mysql.com/doc/refman/5.7/en/auto-reconnect.html). :strict - Defaults to true. Enable STRICT_ALL_TABLES. (See MySQL documentation: http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html) :variables - (Optional) A hash session variables to send as SET @@SESSION.key = value on each database connection. Use the value +:default+ to set a variable to its DEFAULT value. (See MySQL documentation: http://dev.mysql.com/doc/refman/5.7/en/set-statement.html). :sslca - Necessary to use MySQL with an SSL connection. :sslkey - Necessary to use MySQL with an SSL connection. :sslcert - Necessary to use MySQL with an SSL connection. :sslcapath - Necessary to use MySQL with an SSL connection. :sslcipher - Necessary to use MySQL with an SSL connection. Rails ActiveRecord适配器的github,https://github.com/rails/rails/tree/master/activerecord/lib/active_record/connection_adapters 编辑: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |