mirror of
https://github.com/dunwu/linux-tutorial.git
synced 2024-04-15 19:55:24 +08:00
46 lines
1.7 KiB
INI
46 lines
1.7 KiB
INI
[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
|