1. 首页
  2. IT资讯

【MySQL】my.cnf 配置文件

记录一份 my.cnf 作为自己生产的标配, 仅供参考。

  1. [client]
  2. defaultcharacterset = utf8mb4
  3. port = PORT
  4. socket = /srv/myPORT/run/mysql.sock
  5. [mysqld]
  6. user = mysql
  7. port = PORT
  8. extraport = 1PORT
  9. character_set_server = utf8mb4
  10. server_id = SERVER_ID
  11. socket = /srv/myPORT/run/mysql.sock
  12. basedir = /opt/perconaserver
  13. datadir = /srv/myPORT/data
  14. logerror = /srv/myPORT/log/alert.log
  15. pidfile = /srv/myPORT/run/mysql.pid
  16. log_slave_updates = 1
  17. logbin = /srv/myPORT/log/mysqlbin
  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. relaylog = /srv/myPORT/log/relaybin
  24. relayloginfofile = /srv/myPORT/log/relaylog.info
  25. relaylogindex = /srv/myPORT/log/relaylog.index
  26. masterinfofile = /srv/myPORT/log/master.info
  27. relaylogrecovery = true
  28. syncrelayloginfo = 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. defaultstorageengine= INNODB
  48. transaction_isolation = READCOMMITTED
  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. skipnameresolve
  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 = poolofthreads
  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. noautorehash
  82. [mysqlhotcopy]
  83. interactivetimeout

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28686045/viewspace-2126254/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:布吉卡,转转请注明出处:http://www.cxybcw.com/195535.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code