db.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. return [
  3. 'db' => [
  4. 'class' => 'yii\db\Connection',
  5. // 'dsn' => 'mysql:host=192.168.1.214;dbname=valuesys',
  6. // 'dsn' => 'pgsql:host=127.0.0.1;port=5432;dbname=financialdb',
  7. 'dsn' => 'pgsql:host=172.16.107.5;port=5432;dbname=financialdb',
  8. 'username' => 'finance',
  9. 'password' => 'Finance@unicom23',
  10. 'charset' => 'utf8',
  11. 'tablePrefix' => 'car_theme"."wz_',
  12. /* 'schemaMap' => [
  13. 'pgsql'=> [
  14. 'class'=>'yii\db\pgsql\Schema',
  15. 'defaultSchema' => 'public' //specify your schema here
  16. ]
  17. ]*/
  18. // Schema cache options (for production environment)
  19. //'enableSchemaCache' => true,
  20. //'schemaCacheDuration' => 60,
  21. //'schemaCache' => 'cache',
  22. /*
  23. // 配置从服务器账户密码
  24. 'slaveConfig' => [
  25. 'username' => 'root',
  26. 'password' => 'root',
  27. 'attributes' => [
  28. // use a smaller connection timeout
  29. PDO::ATTR_TIMEOUT => 10,
  30. ],
  31. 'charset' => 'utf8',
  32. ],
  33. //配置从服务器组
  34. 'slaves' => [
  35. ['dsn' => 'mysql:host=192.168.0.2;dbname=hyii2'],
  36. ],
  37. */
  38. ],
  39. 'db2' => [
  40. 'class' => 'yii\db\Connection',
  41. # 'dsn' => 'mysql:host=192.168.1.214;dbname=valuesys',
  42. 'dsn' => 'pgsql:host=172.16.107.5;port=5432;dbname=valuesys1',
  43. 'username' => 'valuesys',
  44. 'password' => 'Hebei12#$',
  45. 'charset' => 'utf8mb4',
  46. 'tablePrefix' => 'wz_',
  47. // Schema cache options (for production environment)
  48. //'enableSchemaCache' => true,
  49. //'schemaCacheDuration' => 60,
  50. //'schemaCache' => 'cache',
  51. /*
  52. // 配置从服务器账户密码
  53. 'slaveConfig' => [
  54. 'username' => 'root',
  55. 'password' => 'root',
  56. 'attributes' => [
  57. // use a smaller connection timeout
  58. PDO::ATTR_TIMEOUT => 10,
  59. ],
  60. 'charset' => 'utf8',
  61. ],
  62. //配置从服务器组
  63. 'slaves' => [
  64. ['dsn' => 'mysql:host=192.168.0.2;dbname=hyii2'],
  65. ],
  66. */
  67. ],
  68. ];