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. ituring 挂了

    ituring 挂了 图灵社区 挂了 运行时错误 "/"应用程序中的服务器错误. 运行时错误 说明: 服务器上出现应用程序错误.此应用程序的当前自定义错误设置禁止远程查看应用程序错 ...

  2. SQL All In One

    SQL All In One Structured Query Language SQL is an ANSI (American National Standards Institute) stan ...

  3. Taro 开发踩坑指南 (小程序,H5, RN)

    Taro 开发踩坑指南 (小程序,H5, RN) css taro 如何展示多行文本省略号 https://www.cnblogs.com/xgqfrms/p/12569057.html UI 设计稿 ...

  4. vue农历日历

    <template> <div class="calendar-main"> <div class="choose_year"&g ...

  5. GoEasy使用阿里云OSS出现的问题

    前言:本人使用goeasy来实现微信小程序里面和其他人的im临时对话窗口,想要实现可以同时发送语音和视频.图片.表情包的话,就要通过goeasy关联到阿里云的存储对象. 报错:The OSS Acce ...

  6. 去中心化预言机如何助力NGK DeFi 项目发展?

    早在 2014 年前后,协议智能合约就已经出现了,最初协议很笨重,包含了许多不同的部分,每个部分都是一个单独的智能合约,你需要在区块链本身的协议中添加不同的智能合约,这需要几个月甚至几年的时间,而之后 ...

  7. Ubuntu 下安装Anaconda + 显卡驱动 + CUDA + CUDNN + 离线安装环境

    写来给自己备忘,并不是什么教程- .- 下载安装包 Anaconda:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 显卡驱动:https ...

  8. 无法将“node.exe”项识别为 cmdlet、函数、脚本文件或可运行程序的名称

    有些天没有启动前端项目,发现npm run dev,启动不了,经过一番查找发现问题所在 然后我查看了一下报错位置,发现并没有改动过什么 解决方法: 方法一: 检查一下npm目录: 这里发现少了node ...

  9. HTTP/1.1 有点慢,我想优化下!

    问你一句:「你知道 HTTP/1.1 该如何优化吗?」 我想你第一时间想到的是,使用 KeepAlive 将 HTTP/1.1 从短连接改成长链接. 这个确实是一个优化的手段,它是从底层的传输层这一方 ...

  10. 《进击吧!Blazor!》第一章 5.组件开发

    <进击吧!Blazor!>是本人与张善友老师合作的Blazor零基础入门系列视频,此系列能让一个从未接触过Blazor的程序员掌握开发Blazor应用的能力. 视频地址:https://s ...