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. ...
随机推荐
- Cocos Creator 游戏开发
Cocos Creator 游戏开发 https://www.cocos.com/products#CocosCreator 一体化编辑器: 包含了一体化.可扩展的编辑器,简化了资源管理.游戏调试和预 ...
- V8 & ECMAScript & ES-Next
V8 & ECMAScript & ES-Next ES6, ES7, ES8, ES9, ES10, ES11, ES2015, ES2016, ES2017, ES2018, ES ...
- Nestjs 修改dist目录
修改tsconfig.json { "compilerOptions": { "outDir": "./server-dist", // 这 ...
- 2020 新型肺炎病毒疫情 & 远程办公
2020 新型肺炎病毒疫情 & 远程办公 2020 新型肺炎病毒疫情 https://zhuanlan.zhihu.com/p/104406687 钉钉 微信 code gitlab PRD ...
- js 的 ArrayBuffer 和 dataView
arrayBuffer文档 一个十六进制代表4位,0xF = 1111,0xFF = 1111 1111,八位是1字节,所以通常用两个16进制代表1字节. 假如我申请一个8字节的内存空间,然后初始化为 ...
- 为什么说NGK引领全球数字资产财富革命
进入2020年,区块链万业迸发出巨大的能量,事实上区块链和数字经济正是未来全球财富的新方向.区块链和数字货币的增值空间巨大,是数字时代新的经济增长点.目前,全球衍生品市场价值532万亿美元,全球债务市 ...
- 【从零开始撸一个App】Fragment和导航中的使用
Fragment简介 Fragment自从Android 3.0引入开始,它所承担的角色就是显而易见的.它之于Activity就如html片段之于页面,好处无需赘述. Fragment的生命周期和Ac ...
- 报错问题: AtrributeError:module ‘allure’ has no attribute ‘’severity_level’
问题:执行命令报错:pytest -s -q --alluredir report 报错问题: AtrributeError:module 'allure' has no attribute ''se ...
- Java程序员必备后台前端框架--Layui【从入门到实战】(二)
layui使用 导航菜单.选项卡 作者 : Stanley 罗昊 [转载请注明出处和署名,谢谢!] [编程工具:IDEA] 导航菜单 在layui官网中示例中,我们可以找到关于导航的例子: 我们点击查 ...
- Linux速通02 命令格式
命令的格式 # 格式:命令 [选项][参数] * 命令:告诉 Linux操作系统执行什么 * 选项:说明命令运行的方式(可以改变命令的功能).以 "-"字符开始 * 参数:说明命令 ...