【MySQL】my.cnf 配置檔案

zlingyi發表於2016-10-13
記錄一份 my.cnf 作為自己生產的標配, 僅供參考。

  1. [client]
  2. default-character-set         = utf8mb4
  3. port                          = PORT
  4. socket                        = /srv/myPORT/run/mysql.sock

  5. [mysqld]
  6. user                          = mysql
  7. port                          = PORT
  8. extra-port                    = 1PORT
  9. character_set_server          = utf8mb4
  10. server_id                     = SERVER_ID
  11. socket                        = /srv/myPORT/run/mysql.sock
  12. basedir                       = /opt/percona-server
  13. datadir                       = /srv/myPORT/data
  14. log-error                     = /srv/myPORT/log/alert.log
  15. pid-file                      = /srv/myPORT/run/mysql.pid
  16. log_slave_updates             = 1
  17. log-bin                       = /srv/myPORT/log/mysql-bin
  18. binlog_format                 = row
  19. binlog_cache_size             = 2M
  20. max_binlog_cache_size         = 4G
  21. max_binlog_size               = 1G
  22. expire_logs_days              = 7
  23. relay-log                     = /srv/myPORT/log/relay-bin
  24. relay-log-info-file           = /srv/myPORT/log/relay-log.info
  25. relay-log-index               = /srv/myPORT/log/relay-log.index
  26. master-info-file              = /srv/myPORT/log/master.info
  27. relay-log-recovery            = true
  28. sync-relay-log-info           = 1
  29. explicit_defaults_for_timestamp
  30. key_buffer_size               = 2M
  31. sort_buffer_size              = 2M
  32. read_buffer_size              = 2M
  33. read_rnd_buffer_size          = 16M
  34. join_buffer_size              = 2M
  35. thread_cache_size             = 1024
  36. query_cache_size              = 1M
  37. query_cache_limit             = 1M
  38. query_cache_min_res_unit      = 2k
  39. table_open_cache              = 2048
  40. open_files_limit              = 65535
  41. back_log                      = 3000
  42. max_connections               = 4000
  43. max_user_connections          = 2500
  44. max_connect_errors            = 100
  45. max_allowed_packet            = 512M
  46. thread_stack                  = 192k
  47. default-storage-engine        = INNODB
  48. transaction_isolation         = READ-COMMITTED
  49. tmp_table_size                = 16M
  50. max_heap_table_size           = 64M
  51. bulk_insert_buffer_size       = 64M
  52. long_query_time               = 0.5
  53. slow_query_log                = on
  54. slow_query_log_file           = /srv/myPORT/log/slow.log
  55. skip-name-resolve
  56. innodb_buffer_pool_size       = 10G
  57. innodb_data_file_path         = ibdata1:2G:autoextend
  58. innodb_file_io_threads        = 24
  59. innodb_purge_threads          = 12
  60. innodb_read_io_threads        = 24
  61. innodb_write_io_threads       = 24
  62. innodb_thread_concurrency     = 24
  63. innodb_buffer_pool_instances  = 8
  64. innodb_flush_log_at_trx_commit= 1
  65. innodb_log_buffer_size        = 16M
  66. innodb_log_file_size          = 2G
  67. innodb_log_files_in_group     = 2
  68. innodb_max_dirty_pages_pct    = 75
  69. innodb_lock_wait_timeout      = 50
  70. innodb_file_per_table         = 1
  71. thread_handling               = pool-of-threads
  72. thread_pool_idle_timeout      = 180
  73. thread_pool_max_threads       = 5000
  74. thread_pool_size              = 24
  75. thread_pool_oversubscribe     = 10
  76. thread_pool_stall_limit       = 500
  77. [mysqldump]
  78. quick
  79. max_allow_packet              = 64M
  80. [mysql]
  81. no-auto-rehash
  82. [mysqlhotcopy]
  83. interactive-timeout


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28686045/viewspace-2126254/,如需轉載,請註明出處,否則將追究法律責任。

相關文章