Skip to content

Instantly share code, notes, and snippets.

@J1nH4ng
Last active April 7, 2024 09:19
Show Gist options
  • Save J1nH4ng/ced906ff3e281360c626301407acd7db to your computer and use it in GitHub Desktop.
Save J1nH4ng/ced906ff3e281360c626301407acd7db to your computer and use it in GitHub Desktop.
[Mysql 配置文件] Mysql 配置文件 #Devops #Mysql
# mysql 8.0 配置文件
[mysqld]
# Specifies the server ID
server_id=1
# 只能用IP地址检查客户端的登录
skip_name_resolve=On
# 日志内记录时间使用系统时间(the local system time zone)
log_timestamps=SYSTEM
# 进程ID的文件所在目录
pid_file=/var/run/mysql/mysqld.pid
# 最大连接数
max_connections=2000
## 超时
interactive_timeout=60
wait_timeout=60
# The path to the MySQL installation base directory
basedir=/usr/local/mysql8.0
# 数据文件所在位置
datadir=/data/mysql
# 设置socket文件所在目录(默认值)
socket=/tmp/mysql.sock
# 数据库错误日志文件
log_error=/var/log/mysql/mysqld-error.log
# 慢日志相关配置
slow_query_log=1
long_query_time=3 #3 seconds
slow_query_log_file=/var/log/mysql/mysqld-slow.log
# 二进制日志
log_bin=mysql-bin
max_binlog_size=1G
binlog_expire_logs_seconds=15552000 #180 days
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment