MySQL5.7和MySQL8.0通用配置文件
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通用配置文件的更多相关文章
- MySQL下载与MySQL安装图解(MySQL5.7与MySQL8.0)
MySQL下载与MySQL安装图解(MySQL5.7与MySQL8.0) 1.MySQL下载(MySQL8.0社区版) mysql下载方法,请根据风哥以下步骤与图示来下载mysql8.0最新社区版本: ...
- Win10下mysql5.5和mysql8.0.19共存
Win10下mysql5.5和mysql8.0.19共存 需求:由于之前做的项目用的是mysql5.5,而新接的项目指定用mysql8,需要myql5..5和8同时存在运行. 前提:电脑已经安装mys ...
- 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 # 设 ...
- Mysql8.0新特性【详细版本】
1. 账户与安全 用户创建与授权 之前:创建用户并授权 1 grant all privileges on *.* to 'myuser'@'%' identified by '3edc#EDC'; ...
- 解决MySQL8.0报错:Unknown system variable 'validate_password_policy'
一.问题描述 1.在安装MySQL8.0时,修改临时密码,因密码过于简单(如:123456),不符合MySQL密码规范,会触发一个报错信息: ERROR 1819 (HY000): Your pass ...
- MySQL8.0修改临时密码
解决MySQL8.0报错:Unknown system variable 'validate_password_policy' 一.问题描述 1.在安装MySQL8.0时,修改临时密码,因密码过于简单 ...
- mac 下安装mysql8.0
有两种安装方式,一种是安装包安装,官网下载安装包,mysql8.0下载.mysql5.7安装: 这里记录brew安装: 1.brew uninstall mysql 卸载原有的: 2.brew ins ...
- mysql-8.0 安装教程(自定义配置文件,密码方式已修改)
下载zip安装包: MySQL8.0 For Windows zip包下载地址:https://dev.mysql.com/downloads/file/?id=476233,进入页面后可以不登录.后 ...
- mysql5.5换成mysql8.0
由于在建表钟发现有些语句就是录不进去,研究发现是因为5.5版本过低导致,就想换到5.7版本,结果一看8.0都出了,据官方说明8.0要比5系列快2倍网上,遂直接换成8.0了,不过这个过程真的心累. 1. ...
随机推荐
- git include只包含某些文件
.gitignore: * # include !.gitignore !a.txt !dir2
- 「NGK每日快讯」2021.1.7日NGK第65期官方快讯!
- 去中心化预言机如何助力NGK DeFi 项目发展?
早在 2014 年前后,协议智能合约就已经出现了,最初协议很笨重,包含了许多不同的部分,每个部分都是一个单独的智能合约,你需要在区块链本身的协议中添加不同的智能合约,这需要几个月甚至几年的时间,而之后 ...
- 图片居中的flex实现
文本居中 text-align:center; 如果是图片放在div中,就没办法了.用flex可以很简单实现. display: flex; justify-content: center; /* 图 ...
- SecureCRT无法登陆ubuntu问题解决的方法(亲测有效)
最近在虚拟机安装了几个ubuntu系统玩耍,然后想着用SecureCRT在Windows本地连接但是怎么也连接不上!!!如下,这只是示意图,ip地址是瞎编的,但是情况完全相同,期间尝试过让linux和 ...
- Kubernetes-1.概述
内容主要摘自官网文档资料 官方地址 概述Kubernetes基本信息 前提条件: 掌握容器或Docker知识 文档编写基于kubernetes v1.17版本 目录 概述 Kubernetes对象 K ...
- 后端程序员之路 13、使用KNN进行数字识别
尝试一些用KNN来做数字识别,测试数据来自:MNIST handwritten digit database, Yann LeCun, Corinna Cortes and Chris Burgesh ...
- 如何读写拥有命名空间xmlns 属性的Xml文件(C#实现)
我们在进行C#项目Xml读写开发时经常遇到一些读写问题,今天我要介绍的是遇到多个命名空间xmlns属性时如何读写此类文件. 比如下面这个Xml文件: <?xml version="1. ...
- JVM之类加载器子系统
类加载器子系统 作用 负责从文件系统或网络系统中加载class文件,class文件在开头有特殊的标记(魔术开头CA FE BA BE) ClassLoader只负责加载class文件,至于能否运行,由 ...
- div中如何让文本元素、img元素水平居中且垂直居中
一.文本元素在div中的水平居中且垂直居中方法 html代码 <div id="box"> <p>文本元素</p> </div> c ...