db.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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=192.168.1.214;port=5432;dbname=valuesys',
  7. 'username' => 'postgres',
  8. 'password' => 'Hebei_123.',
  9. 'charset' => 'utf8',
  10. 'tablePrefix' => 'wz_',
  11. // Schema cache options (for production environment)
  12. //'enableSchemaCache' => true,
  13. //'schemaCacheDuration' => 60,
  14. //'schemaCache' => 'cache',
  15. /*
  16. // 配置从服务器账户密码
  17. 'slaveConfig' => [
  18. 'username' => 'root',
  19. 'password' => 'root',
  20. 'attributes' => [
  21. // use a smaller connection timeout
  22. PDO::ATTR_TIMEOUT => 10,
  23. ],
  24. 'charset' => 'utf8',
  25. ],
  26. //配置从服务器组
  27. 'slaves' => [
  28. ['dsn' => 'mysql:host=192.168.0.2;dbname=hyii2'],
  29. ],
  30. */
  31. ],
  32. 'db2' => [
  33. 'class' => 'yii\db\Connection',
  34. # 'dsn' => 'mysql:host=192.168.1.214;dbname=valuesys',
  35. 'dsn' => 'pgsql:host=192.168.1.214;port=5432;dbname=valuesys',
  36. 'username' => 'valuesys',
  37. 'password' => 'Hebei12#$',
  38. 'charset' => 'utf8mb4',
  39. 'tablePrefix' => 'wz_',
  40. // Schema cache options (for production environment)
  41. //'enableSchemaCache' => true,
  42. //'schemaCacheDuration' => 60,
  43. //'schemaCache' => 'cache',
  44. /*
  45. // 配置从服务器账户密码
  46. 'slaveConfig' => [
  47. 'username' => 'root',
  48. 'password' => 'root',
  49. 'attributes' => [
  50. // use a smaller connection timeout
  51. PDO::ATTR_TIMEOUT => 10,
  52. ],
  53. 'charset' => 'utf8',
  54. ],
  55. //配置从服务器组
  56. 'slaves' => [
  57. ['dsn' => 'mysql:host=192.168.0.2;dbname=hyii2'],
  58. ],
  59. */
  60. ],
  61. ];