MySQL5.7 my.cnf配置

[client]
port=3306
socket=/log/mysql/mysql.sock [mysql]
socket=/log/mysql/mysql.sock [mysqladmin]
socket=/log/mysql/mysql.sock
#user=zabbix
#password=Paswwrod [mysqld_safe]
log-error = /log/mysql/error.log [mysqld]
port=3306
skip_name_resolve = 1
skip_symbolic_links = yes
lower_case_table_names = 1
explicit_defaults_for_timestamp = ON
character_set_server = utf8
collation_server = utf8_general_ci datadir = /data/mysql/
socket = /log/mysql/mysql.sock log_error = /log/mysql/mysqld.log
pid_file = /log/mysql/mysqld.pid # binlog
server_id = 100
log_bin = /log/mysql/mysql-bin
binlog_cache_size = 32768
binlog_checksum = CRC32
binlog_format = ROW
# [IGNORE_ERROR|ABORT_SERVER]
binlog_error_action = ABORT_SERVER
binlog_group_commit_sync_delay = 0
binlog_transaction_dependency_tracking = COMMIT_ORDER
binlog_order_commits = ON
binlog_row_image = FULL
binlog_rows_query_log_events = OFF
# 0~99
expire_logs_days = 10
binlog_expire_logs_seconds = 864000
sync_binlog = 1
local_infile = 0 # innodb
innodb_file_per_table = ON
innodb_checksum_algorithm = NONE
# stores all data twice, first to the doublewrite buffer, then to the actual data files
innodb_doublewrite = OFF
# larger is wide range of workloads, particularly for DML operations involving bulk updates
innodb_file_per_table = ON
innodb_max_dirty_pages_pct = 50
innodb_use_native_aio = ON
# specifies whether InnoDB index statistics are persisted to disk
innodb_stats_persistent = ON
# The maximum delay between polls for a spin lock
innodb_spin_wait_delay = 96 # pool buffer
# Keeping the InnoDB page size close to the storage device block size
# minimizes the amount of unchanged data that is rewritten to disk.
innodb_page_size = 16K
innodb_buffer_pool_chunk_size = 128M
innodb_buffer_pool_instances = 4
innodb_buffer_pool_size = 6G
innodb_buffer_pool_dump_at_shutdown = ON
innodb_buffer_pool_dump_now = off
innodb_buffer_pool_dump_pct = 15 # ibdata file, system tablespace
# innodb_data_file_path=datafile_spec1[;datafile_spec2]...
# file_name:file_size[:autoextend[:max:max_file_size]]
innodb_data_home_dir = /log/mysql/
# innodb_data_file_path = ibdata1:4G;ibdata2:32M:autoextend:max:4G
innodb_data_file_path = ibdata1:128M:autoextend:max:4G
innodb_autoextend_increment = 64M # redo logs
# innodb_log_file_size * innodb_log_files_in_group
innodb_log_group_home_dir = /log/mysql/
innodb_log_files_in_group = 2
innodb_log_file_size = 4G
# before the transactions commit. update, insert, or delete many rows, making the log buffer larger saves disk I/O
innodb_log_buffer_size = 64M
innodb_undo_directory = /log/mysql/
# maximum number of .ibd files that MySQL can keep open at one time
innodb_open_files = 5000 # Defines the method used to flush data to InnoDB data files and log files, which can affect I/O throughput
# O_DIRECT can help to avoid double buffering between the InnoDB buffer pool and the operating system file system cache
innodb_flush_method = O_DIRECT
# Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent
innodb_flush_neighbors = 0
innodb_thread_concurrency = 0
innodb_write_io_threads = 8
innodb_read_io_threads = 8
# sets an upper limit on the number of I/O operations performed per second by InnoDB background tasks
innodb_io_capacity = 3000
# causes the innodb_io_capacity setting to be ignored during bursts of I/O activity that occur at checkpoints
innodb_flush_sync = ON
# [0|1|2]
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 30 # pref special
# whether to dynamically adjust the rate of flushing dirty pages in the InnoDB buffer pool based on the workload
innodb_adaptive_flushing = ON
innodb_purge_threads = 2
# optimization for InnoDB tables that can speed up lookups using = and IN operators, by constructing a hash index in memory
# A hash index can be partial; the whole B-tree index does not need to be cached in the buffer pool
innodb_adaptive_hash_index = OFF # buffer size
# Index blocks for MyISAM tables are buffered and are shared by all threads
key_buffer_size = 2G
sort_buffer_size = 8M
read_buffer_size = 8M
join_buffer_size = 64M
tmp_table_size = 2G
max_heap_table_size = 64M
# OFF/ON/DEMAND
#query_cache_type = OFF
#query_cache_size = 32M # connections
max_connections = 5000
max_connect_errors = 100000
wait_timeout = 86400
max_execution_time = 0
interactive_timeout = 7200 # UPDATE wait until there is no pending SELECT or LOCK TABLE READ on the affected table
low_priority_updates = 0
# number of outstanding connection requests MySQL can have
# 50 + (max_connections / 5)
# this value is the size of the listen queue for incoming TCP/IP connections
back_log = 1500
thread_stack = 256K
# 8 + (max_connections / 100)
thread_cache_size = 64
max_allowed_packet = 10M # number of open tables for all threads
table_open_cache = 10000
# value of 8 or 16 is recommended on systems that routinely use 16 or more cores.
table_open_cache_instances = 16
# number of files that the operating system permits mysqld to open
# max_connections * 5 / 10 + max_connections + (table_open_cache * 2)
open_files_limit = 15000 # slow sql
slow_launch_time = 4
slow_query_log = ON
slow_query_log_file = /log/mysql/slow.log sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

MySQL8.0 my.cnf配置文件

[client]
port=3306
socket=/log/mysql/mysql.sock [mysql]
socket=/log/mysql/mysql.sock [mysqladmin]
socket=/log/mysql/mysql.sock [mysqld_safe]
log-error = /log/mysql/error.log [mysqld]
port=3306
user=mysql
datadir=/data/mysql
socket=/log/mysql/mysql.sock log_error=/log/mysql/mysqld.log
pid_file=/log/mysql/mysqld.pid skip_name_resolve=1
skip_symbolic_links=yes
explicit_defaults_for_timestamp=ON
log_timestamps=SYSTEM
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci # binlog
server_id = 100
log_bin = /log/mysql/mysql-bin
binlog_cache_size = 32768
binlog_checksum = CRC32
binlog_format = ROW
# [IGNORE_ERROR|ABORT_SERVER]
binlog_error_action = ABORT_SERVER
binlog_group_commit_sync_delay = 0
binlog_transaction_dependency_tracking = COMMIT_ORDER
binlog_order_commits = ON
binlog_row_image = FULL
binlog_rows_query_log_events = OFF
# 0~99
expire_logs_days = 10
binlog_expire_logs_seconds = 864000
sync_binlog = 1
local_infile = 0 # innodb
innodb_file_per_table = ON
innodb_checksum_algorithm = NONE
# stores all data twice, first to the doublewrite buffer, then to the actual data files
innodb_doublewrite = OFF
# larger is wide range of workloads, particularly for DML operations involving bulk updates
innodb_file_per_table = ON
innodb_max_dirty_pages_pct = 50
innodb_use_native_aio = ON
# specifies whether InnoDB index statistics are persisted to disk
innodb_stats_persistent = ON
# The maximum delay between polls for a spin lock
innodb_spin_wait_delay = 96 # pool buffer
# Keeping the InnoDB page size close to the storage device block size
# minimizes the amount of unchanged data that is rewritten to disk.
innodb_page_size = 16K
innodb_buffer_pool_chunk_size = 128M
innodb_buffer_pool_instances = 4
innodb_buffer_pool_size = 2G
innodb_buffer_pool_dump_at_shutdown = ON
innodb_buffer_pool_dump_now = off
innodb_buffer_pool_dump_pct = 15 # ibdata file, system tablespace
# innodb_data_file_path=datafile_spec1[;datafile_spec2]...
# file_name:file_size[:autoextend[:max:max_file_size]]
#innodb_data_home_dir=/log/mysql/
# innodb_data_file_path=ibdata1:4G;ibdata2:32M:autoextend:max:4G
#innodb_data_file_path=ibdata1:128M:autoextend:max:4G
#innodb_autoextend_increment=64M # redo logs
# innodb_log_file_size * innodb_log_files_in_group
#innodb_log_group_home_dir = /log/mysql/
#innodb_log_files_in_group = 2
#innodb_log_file_size = 4G
# before the transactions commit. update, insert, or delete many rows, making the log buffer larger saves disk I/O
#innodb_log_buffer_size = 64M
#innodb_undo_directory = /log/mysql/
# maximum number of .ibd files that MySQL can keep open at one time
#innodb_open_files = 5000 # Defines the method used to flush data to InnoDB data files and log files, which can affect I/O throughput
# O_DIRECT can help to avoid double buffering between the InnoDB buffer pool and the operating system file system cache
innodb_flush_method = O_DIRECT
# Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent
innodb_flush_neighbors = 0
innodb_thread_concurrency = 0
innodb_write_io_threads = 8
innodb_read_io_threads = 8
# sets an upper limit on the number of I/O operations performed per second by InnoDB background tasks
innodb_io_capacity = 3000
# causes the innodb_io_capacity setting to be ignored during bursts of I/O activity that occur at checkpoints
innodb_flush_sync = ON
# [0|1|2]
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 30 # pref special
# whether to dynamically adjust the rate of flushing dirty pages in the InnoDB buffer pool based on the workload
innodb_adaptive_flushing = ON
innodb_purge_threads = 2
# optimization for InnoDB tables that can speed up lookups using = and IN operators, by constructing a hash index in memory
# A hash index can be partial; the whole B-tree index does not need to be cached in the buffer pool
innodb_adaptive_hash_index = OFF # buffer size
# Index blocks for MyISAM tables are buffered and are shared by all threads
key_buffer_size = 1G
sort_buffer_size = 8M
read_buffer_size = 8M
join_buffer_size = 64M
tmp_table_size = 1G
max_heap_table_size = 64M
# OFF/ON/DEMAND
#query_cache_type = OFF
#query_cache_size = 32M # connections
max_connections = 5000
max_connect_errors = 100000
wait_timeout = 86400
max_execution_time = 0
interactive_timeout = 7200 # UPDATE wait until there is no pending SELECT or LOCK TABLE READ on the affected table
low_priority_updates = 0
# number of outstanding connection requests MySQL can have
# 50 + (max_connections / 5)
# this value is the size of the listen queue for incoming TCP/IP connections
back_log = 1500
thread_stack = 256K
# 8 + (max_connections / 100)
thread_cache_size = 64
max_allowed_packet = 10M # number of open tables for all threads
table_open_cache = 10000
# value of 8 or 16 is recommended on systems that routinely use 16 or more cores.
table_open_cache_instances = 16
# number of files that the operating system permits mysqld to open
# max_connections * 5 / 10 + max_connections + (table_open_cache * 2)
open_files_limit = 15000 # slow sql
slow_launch_time = 4
slow_query_log = ON
slow_query_log_file = /log/mysql/slow.log sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

MySQL5.7和MySQL8.0通用配置文件的更多相关文章

  1. MySQL下载与MySQL安装图解(MySQL5.7与MySQL8.0)

    MySQL下载与MySQL安装图解(MySQL5.7与MySQL8.0) 1.MySQL下载(MySQL8.0社区版) mysql下载方法,请根据风哥以下步骤与图示来下载mysql8.0最新社区版本: ...

  2. Win10下mysql5.5和mysql8.0.19共存

    Win10下mysql5.5和mysql8.0.19共存 需求:由于之前做的项目用的是mysql5.5,而新接的项目指定用mysql8,需要myql5..5和8同时存在运行. 前提:电脑已经安装mys ...

  3. win10安装两个不同版本的mysql(mysql5.7和mysql-8.0.19)

    win10中安装mysql5.7后,安装mysql-8.0.19 在D:\mysql-8.0.19-winx64目录下创建一个my.ini文件 [mysqld] # 设置3307端口 port # 设 ...

  4. Mysql8.0新特性【详细版本】

    1.  账户与安全 用户创建与授权 之前:创建用户并授权 1 grant all privileges on *.* to 'myuser'@'%' identified by '3edc#EDC'; ...

  5. 解决MySQL8.0报错:Unknown system variable 'validate_password_policy'

    一.问题描述 1.在安装MySQL8.0时,修改临时密码,因密码过于简单(如:123456),不符合MySQL密码规范,会触发一个报错信息: ERROR 1819 (HY000): Your pass ...

  6. MySQL8.0修改临时密码

    解决MySQL8.0报错:Unknown system variable 'validate_password_policy' 一.问题描述 1.在安装MySQL8.0时,修改临时密码,因密码过于简单 ...

  7. mac 下安装mysql8.0

    有两种安装方式,一种是安装包安装,官网下载安装包,mysql8.0下载.mysql5.7安装: 这里记录brew安装: 1.brew uninstall mysql 卸载原有的: 2.brew ins ...

  8. mysql-8.0 安装教程(自定义配置文件,密码方式已修改)

    下载zip安装包: MySQL8.0 For Windows zip包下载地址:https://dev.mysql.com/downloads/file/?id=476233,进入页面后可以不登录.后 ...

  9. mysql5.5换成mysql8.0

    由于在建表钟发现有些语句就是录不进去,研究发现是因为5.5版本过低导致,就想换到5.7版本,结果一看8.0都出了,据官方说明8.0要比5系列快2倍网上,遂直接换成8.0了,不过这个过程真的心累. 1. ...

随机推荐

  1. how to create a style element in js (many ways)

    how to create a style element in js (many ways) create style in js Constructed StyleSheets CSSStyleS ...

  2. Open Collective

    Open Collective Open Collective is an online funding platform for open and transparent communities. ...

  3. js & object & prototype & __proto__ & prototype chain

    js & object & prototype & proto & prototype chain constructor prototype === instance ...

  4. linux bash shell & lsof & grep & ps

    linux bash shell & lsof & grep & ps lsof list all open files # lsof & grep $ lsof -P ...

  5. USDN稳定币应用区块链旅游业

    比特币是区块链1.0时代的标志性产品,稳定币则是区块链2.0时代的标志性产品.在稳定币鼻祖USDT爆出"超发"新闻后曾引发市场的动荡,之后新兴稳定币如春笋般涌现.据不完全同济,目前 ...

  6. 手把手教你Centos7 部署 gitlab社区版

    一.前置说明: 操作系统:Centos 7 物理内存:>=2G 本人亲测,如果安装低版本的gitlab,比如我这里所使用的v8.17.0,物理内存1G,swap 2G虚拟内存即可部署.高版本的所 ...

  7. 微信小程序优化:实现picker组件中input输入框禁止输入,而只能通过picker组件选择日期

    原来的代码如下: <view class="right">     <picker mode="date" value="{{mat ...

  8. hive分区分桶

    目录 1.分区 1.1.静态分区 1.1.1.一个分区 1.1.2.多个分区 1.2.动态分区 2.分桶 1.分区 如果一个表中数据很多,我们查询时就很慢,耗费大量时间,如果要查询其中部分数据该怎么办 ...

  9. Go - 代码生成工具

    分享两个常用的代码生成工具: gormgen handlergen gormgen 基于 MySQL 数据表结构进行生成 3 个文件: 生成表的 struct 结构体 生成表的 Markdown 文档 ...

  10. STM32学习笔记——序言

    写AVR已经两年了.如果初中时候玩Arduino也算的话,就是6年. 两年以来,我用AVR单片机完成了两个大项目: AVR单片机教程,一时兴起写的,效果不好: MEDS,参赛用的课题,半完成,比赛都结 ...