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. ...
随机推荐
- how to disabled prefers-color-scheme in js & dark theme
how to disabled prefers-color-scheme in js dark theme https://developer.mozilla.org/en-US/docs/Web/C ...
- Free Serverless
Free Serverless BFF https://cloud.google.com/functions/ 微服务 Function as a Servcie,FaaS https://segme ...
- subline3 如何设置es6高亮
步骤: 1.操作Ctrl+Shift+P , 然后在弹出的框内输入Package Control: in,2.选择Package Control: install package,3.等待再次弹出输入 ...
- Redis的数据结构与应用场景
一.Redis简介 Redis 是一个开源的使用 ANSI C 语言编写.遵守 BSD 协议.支持网络.可基于内存.分布式.可选持久性的键值对(Key-Value)存储数据库,并提供多种语言的 API ...
- 在gradle中构建java项目
目录 简介 构建java项目的两大插件 管理依赖 编译代码 管理resource 打包和发布 生成javadoc 简介 之前的文章我们讲到了gradle的基本使用,使用gradle的最终目的就是为了构 ...
- iOS 兼容性处理
1. scroll滑动层,在iOS中滑动不流畅的处理 -webkit-overflow-scrolling:touch; //在滑动层标签添加这个样式 2. iOS 系统中input标签,去掉圆角效果 ...
- Python算法_整数反转(02)
给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转. 示例 1: 输入: 123输出: 321 示例 2: 输入: -123输出: -321 示例 3: 输入: 120 输出: 2 ...
- 2.go语言入门----变量类型、声明变量、数组、切片
基本变量类型 介绍几种基本的变量类型:字符串.int.float.bool package main import ( "fmt" ) // 列举几种非常基本的数据类型 func ...
- 在测试自定义starter时,若出现无法找到helloservice的Bean的解决方法
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoc ...
- Oracle数据库配置监听程序
最近在学习Oracle数据库,从安装到配置监听程序基本靠百度... 不得不说百度真的很nice!!! 下面是我的Oracle服务端(PL/SQL Developer)出现的监听程序的问题及我解决的方法 ...