Advertisement
Guest User

Untitled

a guest
May 24th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. # Optimized MySQL configuration for cPanel servers by Fotis Evangelou - Updated Feb 2016
  2. #
  3. # The settings provided below are a starting point for a 4GB-8GB RAM server with 4 CPU cores.
  4. # If you have less or more resources available you MUST adjust accordingly to save CPU, RAM and disk I/O usage.
  5. # To fine tune these settings for your system, use MySQL DB diagnostics tools like:
  6. # https://launchpad.net/mysql-tuning-primer
  7. # or
  8. # http://blog.mysqltuner.com/download/
  9. # Note that if there is NO comment beside a setting, then you don't need to adjust it.
  10.  
  11. [client]
  12. port = 3306
  13. socket = /tmp/mysql.sock
  14.  
  15. [mysqld_safe]
  16. socket = /tmp/mysql.sock
  17. nice = 0
  18.  
  19. [mysqld]
  20. basedir = /usr
  21. bind-address = 127.0.0.1 # Comment this line if you want remote clients to connect to your MySQL instance
  22. datadir = /var/lib/mysql
  23. lc-messages-dir = /usr/share/mysql
  24. max_allowed_packet = 16M
  25. myisam-recover = BACKUP
  26. pid-file = /var/run/mysqld/mysqld.pid
  27. port = 3306
  28. skip-external-locking
  29. socket = /tmp/mysql.sock
  30. thread_stack = 192K
  31. tmpdir = /tmp
  32. user = mysql
  33.  
  34. # ============================================================ #
  35. # =============== Custom server tweaks [start] =============== #
  36. # ============================================================ #
  37.  
  38. default_storage_engine = InnoDB
  39. innodb_buffer_pool_size = 2G # Use up to 70-80% of RAM & optionally check if /proc/sys/vm/swappiness is set to 0. Use Tuning Primer or MySQL Tuner to adjust accordingly.
  40. innodb_file_per_table = 1
  41. innodb_flush_log_at_trx_commit = 0
  42. innodb_flush_method = O_DIRECT
  43. innodb_log_buffer_size = 8M
  44. innodb_log_file_size = 128M # Delete the ib_logfile0 & ib_logfile1 files in /var/lib/mysql whenever you change this, even the first time you set it up, as the default value is 8M. Don't go above 256M.
  45.  
  46. query_cache_limit = 3M # The max size of queries to cache. Use Tuning Primer or MySQL Tuner to adjust accordingly.
  47. query_cache_size = 48M # The total query cache size for MyISAM tables. Use Tuning Primer or MySQL Tuner to adjust accordingly.
  48. query_cache_type = 1
  49.  
  50. max_connections = 80 # Total connection limit for all MySQL users. Adjusting this too high will result in excess resource usage even if it's not required. Use Tuning Primer or MySQL Tuner to adjust accordingly.
  51. max_user_connections = 60 # Per user connection limit
  52.  
  53. key_buffer_size = 48M # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  54.  
  55. wait_timeout = 300 # Using 300 secs for maintaining connections keeps the entire connections count low, thus decreasing resource consumption.
  56.  
  57. join_buffer_size = 2M # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  58. sort_buffer_size = 2M # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  59. read_buffer_size = 2M # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  60. read_rnd_buffer_size = 2M # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  61.  
  62. max_heap_table_size = 128M # According to Percona, these values do not affect performance. Percona sets those to 32M. 128M is a reasonable value though.
  63. tmp_table_size = 128M # See above.
  64.  
  65. table_definition_cache = 5000 # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  66. table_open_cache = 5000 # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  67. open_files_limit = 15000 # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  68.  
  69. low_priority_updates = 1
  70. concurrent_insert = 2
  71. thread_cache_size = 40 # Use Tuning Primer or MySQL Tuner to adjust accordingly.
  72. thread_concurrency = 8 # Set to twice the number of cores (2 x 4 cores in this example)
  73.  
  74. ft_min_word_len = 3 # Minimum length of words to be indexed for search results
  75.  
  76. log-error = /var/lib/mysql/mysql_error.log
  77. log-queries-not-using-indexes = 1
  78. slow-query-log = 1
  79. slow-query-log-file = /var/lib/mysql/mysql_slow.log
  80. long_query_time = 5
  81. expire_logs_days = 7
  82. max_binlog_size = 100M
  83.  
  84. # ============================================================ #
  85. # ============== Custom server tweaks [finish] =============== #
  86. # ============================================================ #
  87.  
  88. [mysqldump]
  89. quick
  90. quote-names
  91. max_allowed_packet = 16M
  92.  
  93. [mysql]
  94.  
  95. [isamchk]
  96. key_buffer = 16M
  97. Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
  98. Status API Training Shop Blog About
  99. © 2016 GitHub, Inc. Terms Privacy Security Contact Help
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement