Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.59 KB | None | 0 0
  1. [mysql]
  2. port = 3306
  3. socket = /var/run/mysqld/mysqld.sock
  4.  
  5. [mysqld]
  6. # === Required Settings ===
  7. basedir = /usr
  8. #bind_address = 127.0.0.1 # Change to 0.0.0.0 to allow remote connections
  9. datadir = /var/lib/mysql
  10. #default_authentication_plugin = mysql_native_password # Enable in MySQL 8+ or MariaDB 10.6+ for backwards compatibility with common CMSs
  11. max_allowed_packet = 256M
  12. max_connect_errors = 1000000
  13. pid_file = /var/run/mysqld/mysqld.pid
  14. port = 3306
  15. skip_external_locking
  16. skip_name_resolve
  17. socket = /var/run/mysqld/mysqld.sock
  18. tmpdir = /tmp
  19. user = mysql
  20.  
  21. # === SQL Compatibility Mode ===
  22. # Enable for b/c with databases created in older MySQL/MariaDB versions
  23. # (e.g. when using null dates)
  24. #sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES
  25. # Crappy SQL queries/schema? Go bold!
  26. #sql_mode = ""
  27.  
  28. # === InnoDB Settings ===
  29. default_storage_engine = InnoDB
  30. innodb_buffer_pool_instances = 4 # Use 1 instance per 1GB of InnoDB pool size - max is 64
  31. innodb_buffer_pool_size = 4G # Use up to 70-80% of RAM
  32. innodb_file_per_table = 1
  33. innodb_flush_log_at_trx_commit = 0
  34. innodb_flush_method = O_DIRECT
  35. innodb_log_buffer_size = 16M
  36. innodb_log_file_size = 512M
  37. innodb_sort_buffer_size = 4M # UPD - Defines how much data is read into memory for sorting operations before writing to disk (default is 1M / max is 64M)
  38. innodb_stats_on_metadata = 0
  39. #innodb_use_fdatasync = 1 # Only (!) for MySQL v8.0.26+
  40.  
  41. #innodb_temp_data_file_path = ibtmp1:64M:autoextend:max:20G # Control the maximum size for the ibtmp1 file
  42. #innodb_thread_concurrency = 4 # Optional: Set to the number of CPUs on your system (minus 1 or 2) to better
  43. # contain CPU usage. E.g. if your system has 8 CPUs, try 6 or 7 and check
  44. # the overall load produced by MySQL/MariaDB.
  45. innodb_read_io_threads = 64
  46. innodb_write_io_threads = 64
  47. #innodb_io_capacity = 2000 # Depends on the storage tech - use 2000 for SSD, more for NVMe
  48. #innodb_io_capacity_max = 4000 # Usually double the value of innodb_io_capacity
  49.  
  50. # === MyISAM Settings ===
  51. # The following 3 options are ONLY supported by MariaDB & up to MySQL 5.7
  52. # Do NOT un-comment on MySQL 8.x+
  53. #query_cache_limit = 4M # UPD
  54. #query_cache_size = 64M # UPD
  55. #query_cache_type = 1 # Enabled by default
  56.  
  57. key_buffer_size = 24M # UPD
  58.  
  59. low_priority_updates = 1
  60. concurrent_insert = 2
  61.  
  62. # === Connection Settings ===
  63. max_connections = 300 # UPD - Important: high no. of connections = high RAM consumption
  64.  
  65. back_log = 512
  66. thread_cache_size = 100
  67. thread_stack = 192K
  68.  
  69. interactive_timeout = 180
  70. wait_timeout = 180
  71.  
  72. # For MySQL 5.7+ only (disabled by default)
  73. #max_execution_time = 90000 # Set a timeout limit for SELECT statements (value in milliseconds).
  74. # This option may be useful to address aggressive crawling on large sites,
  75. # but it can also cause issues (e.g. with backups). So use with extreme caution and test!
  76. # More info at: https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_execution_time
  77.  
  78. # For MariaDB 10.1.1+ only (disabled by default)
  79. #max_statement_time = 90 # The equivalent of "max_execution_time" in MySQL 5.7+ (set above)
  80. # The variable is of type double, thus you can use subsecond timeout.
  81. # For example you can use value 0.01 for 10 milliseconds timeout.
  82. # More info at: https://mariadb.com/kb/en/aborting-statements/
  83.  
  84. # === Buffer Settings ===
  85. # Handy tip for managing your database's RAM usage:
  86. # The following values should be treated carefully as they are added together and then multiplied by your "max_connections" value.
  87. # Other options will also add up to RAM consumption (e.g. tmp_table_size). So don't go switching your "join_buffer_size" to 1G, it's harmful & inefficient.
  88. # Use one of the database diagnostics tools mentioned at the top of this file to count your database's potential total RAM usage, so you know if you are within
  89. # reasonable limits. Remember that other services will require enough RAM to operate properly (like Apache or PHP-FPM), so set your limits wisely.
  90. join_buffer_size = 3M # UPD
  91. read_buffer_size = 2M # UPD
  92. read_rnd_buffer_size = 3M # UPD
  93. sort_buffer_size = 3M # UPD
  94.  
  95. # === Table Settings ===
  96. # In systemd managed systems like Ubuntu 16.04+ or CentOS 7+, you need to perform an extra action for table_open_cache & open_files_limit
  97. # to be overriden (also see comment next to open_files_limit).
  98. # E.g. for MySQL 5.7, please check: https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html
  99. # and for MariaDB check: https://mariadb.com/kb/en/library/systemd/
  100. table_definition_cache = 40000 # UPD
  101. table_open_cache = 40000 # UPD
  102. open_files_limit = 60000 # UPD - This can be 2x to 3x the table_open_cache value or match the system's
  103. # open files limit usually set in /etc/sysctl.conf and /etc/security/limits.conf
  104. # In systemd managed systems this limit must also be set in:
  105. # - /etc/systemd/system/mysql.service.d/override.conf (for MySQL 5.7+ in Ubuntu) or
  106. # - /etc/systemd/system/mysqld.service.d/override.conf (for MySQL 5.7+ in CentOS) or
  107. # - /etc/systemd/system/mariadb.service.d/override.conf (for MariaDB)
  108. # otherwise changing open_files_limit will have no effect.
  109. #
  110. # To edit the right file execute:
  111. # $ systemctl edit mysql (or mysqld or mariadb)
  112. # and set "LimitNOFILE=" to something like 100000 or more (depending on your system limits for MySQL)
  113. # or use "LimitNOFILE=infinity" for MariaDB only.
  114. # Finally merge the changes with:
  115. # $ systemctl daemon-reload; systemctl restart mysql (or mysqld or mariadb)
  116.  
  117. max_heap_table_size = 128M # Increase to 256M or 512M if you have lots of temporary tables because of missing indices in JOINs
  118. tmp_table_size = 128M # Use same value as max_heap_table_size
  119.  
  120. # === Search Settings ===
  121. ft_min_word_len = 3 # Minimum length of words to be indexed for search results
  122.  
  123. # === Binary Logging ===
  124. disable_log_bin = 1 # Binary logging disabled by default
  125. #log_bin # To enable binary logging, uncomment this line & only one of the following 2 lines
  126. # that corresponds to your actual MySQL/MariaDB version.
  127. # Remember to comment out the line with "disable_log_bin".
  128. #expire_logs_days = 1 # Keep logs for 1 day - For MySQL 5.x & MariaDB before 10.6 only
  129. #binlog_expire_logs_seconds = 86400 # Keep logs for 1 day (in seconds) - For MySQL 8+ & MariaDB 10.6+ only
  130.  
  131. # === Error & Slow Query Logging ===
  132. log_error = /var/lib/mysql/mysql_error.log
  133. log_queries_not_using_indexes = 0 # Disabled on production
  134. long_query_time = 5
  135. slow_query_log = 0 # Disabled on production
  136. slow_query_log_file = /var/lib/mysql/mysql_slow.log
  137.  
  138. [mysqldump]
  139. # Variable reference
  140. # For MySQL 5.7+: https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html
  141. # For MariaDB: https://mariadb.com/kb/en/library/mysqldump/
  142. quick
  143. quote_names
  144. max_allowed_packet = 1024M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement