linux-tutorial/codes/linux/soft/config/mysql/my.cnf
2019-11-26 17:11:53 +08:00

46 lines
1.7 KiB
INI
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[mysqld]
# mysql 的数据目录
datadir = /var/lib/mysql
# binlog 目录
log_bin = /var/lib/mysql/binlog
# socket 文件
socket = /var/lib/mysql/mysql.sock
# 设置时区
default-time_zone = '+8:00'
# 数据库默认字符集
character-set-server = utf8mb4
# 数据库字符集对应一些排序等规则,注意要和 character-set-server 对应
collation-server = utf8mb4_0900_ai_ci
# 数据库连接相关设置
# -------------------------------------------------------------------------------
# 最大连接数
max_connections = 10000
# 最大错误连接数
max_connect_errors = 10000
# MySQL打开的文件描述符限制
open_files_limit = 65535
# 日志文件相关设置,一般只开启三种日志,错误日志,慢查询日志,二进制日志。普通查询日志不开启。
# -------------------------------------------------------------------------------
# 错误日志记录的信息
log_error_verbosity = 2
# 错误日志文件地址
log-error = /var/log/mysqld.log
# 开启慢查询
slow_query_log = 1
# 开启慢查询时间此处为3秒达到此值才记录数据
long_query_time = 3
# 检索行数达到此数值,才记录慢查询日志中
min_examined_row_limit = 10
# 慢查询日志文件地址
slow-query-log-file = /var/log/mysqld-slow.log
# 开启记录没有使用索引查询语句
log_queries_not_using_indexes = 1
# mysql清除过期日志的时间默认值0不自动清理而是使用滚动循环的方式。这里设置为30天
binlog_expire_logs_seconds = 2592000
# 如果二进制日志写入的内容超出给定值日志就会发生滚动。你不能将该变量设置为大于1GB或小于4096字节。 默认值是1GB。
max_binlog_size = 1000M