database.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. return [
  3. // 默认使用的数据库连接配置
  4. 'default' => env('database.driver', 'mysql'),
  5. // 自定义时间查询规则
  6. 'time_query_rule' => [],
  7. // 自动写入时间戳字段
  8. // true为自动识别类型 false关闭
  9. // 字符串则明确指定时间字段类型 支持 int timestamp datetime date
  10. 'auto_timestamp' => true,
  11. // 时间字段取出后的默认时间格式
  12. 'datetime_format' => 'Y-m-d H:i:s',
  13. // 数据库连接配置信息
  14. 'connections' => [
  15. 'mysql' => [
  16. // 数据库类型
  17. 'type' => env('database.type', 'mysql'),
  18. // 服务器地址
  19. 'hostname' => env('database.hostname', '127.0.0.1'),
  20. // 数据库名
  21. 'database' => env('database.database', ''),
  22. // 用户名
  23. 'username' => env('database.username', 'root'),
  24. // 密码
  25. 'password' => env('database.password', ''),
  26. // 端口
  27. 'hostport' => env('database.hostport', '3306'),
  28. // 数据库连接参数
  29. 'params' => [],
  30. // 数据库编码默认采用utf8
  31. 'charset' => env('database.charset', 'utf8'),
  32. // 数据库表前缀
  33. 'prefix' => env('database.prefix', ''),
  34. // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
  35. 'deploy' => env('database.deploy', 0),
  36. // 数据库读写是否分离 主从式有效
  37. 'rw_separate' => env('database.separate', false),
  38. // 读写分离后 主服务器数量
  39. 'master_num' => 1,
  40. // 指定从服务器序号
  41. 'slave_no' => '',
  42. // 是否严格检查字段是否存在
  43. 'fields_strict' => true,
  44. // 是否需要断线重连
  45. 'break_reconnect' => true,
  46. // 监听SQL
  47. 'trigger_sql' => env('app_debug', true),
  48. // 开启字段缓存
  49. 'fields_cache' => false,
  50. // 字段缓存路径
  51. 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
  52. ],
  53. // 更多的数据库配置信息
  54. 'csm' => [
  55. // 数据库类型
  56. 'type' => env('csm.type', 'mysql'),
  57. // 服务器地址
  58. 'hostname' => env('csm.hostname', '127.0.0.1'),
  59. // 数据库名
  60. 'database' => env('csm.database', ''),
  61. // 用户名
  62. 'username' => env('csm.username', 'root'),
  63. // 密码
  64. 'password' => env('csm.password', ''),
  65. // 端口
  66. 'hostport' => env('csm.hostport', '3306'),
  67. // 数据库连接参数
  68. 'params' => [],
  69. // 数据库编码默认采用utf8
  70. 'charset' => env('csm.charset', 'utf8'),
  71. // 数据库表前缀
  72. 'prefix' => env('csm.prefix', ''),
  73. ],
  74. 'chuxubao' => [
  75. // 数据库类型
  76. 'type' => 'mysql',
  77. // 服务器地址
  78. 'hostname' => '10.28.5.46',
  79. // 数据库名
  80. 'database' => 'renrenxiang',
  81. // 用户名
  82. 'username' => 'root',
  83. // 密码
  84. 'password' => 'Zm#T2ZW4#IwENBY',
  85. // 端口
  86. 'hostport' => '3306',
  87. // 数据库连接参数
  88. 'params' => [],
  89. // 数据库编码默认采用utf8
  90. 'charset' => env('database.charset', 'utf8'),
  91. // 数据库表前缀
  92. 'prefix' => env('database.prefix', ''),
  93. // 是否严格检查字段是否存在
  94. 'fields_strict' => true,
  95. // 是否需要断线重连
  96. 'break_reconnect' => true,
  97. ],
  98. ],
  99. ];