anxin-ruoyi/docker/configs/my.cnf.staging
2026-01-08 20:47:24 +08:00

72 lines
1.7 KiB
Plaintext

# MySQL配置文件 - 测试环境
# 针对测试环境优化的MySQL配置
[mysqld]
# 基础配置
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
# 字符集配置
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect = 'SET NAMES utf8mb4'
# 网络配置
bind-address = 0.0.0.0
max_connections = 150
max_connect_errors = 50000
max_allowed_packet = 48M
interactive_timeout = 450
wait_timeout = 450
# 缓存配置 - 测试环境中等配置
key_buffer_size = 128M
max_allowed_packet = 48M
table_open_cache = 2000
sort_buffer_size = 3M
read_buffer_size = 1.5M
read_rnd_buffer_size = 6M
myisam_sort_buffer_size = 96M
thread_cache_size = 30
# query_cache已在MySQL 8.0中移除
# query_cache_type = 1
# query_cache_size = 96M
# query_cache_limit = 1.5M
# InnoDB配置 - 测试环境中等配置
innodb_buffer_pool_size = 384M
innodb_log_file_size = 96M
innodb_log_buffer_size = 12M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
# 日志配置
log_error = /var/log/mysql/error.log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 1.5
log_queries_not_using_indexes = 1
# 二进制日志配置 - 测试环境启用
log_bin = /var/log/mysql/mysql-bin.log
binlog_format = ROW
binlog_expire_logs_seconds = 259200 # 3天
max_binlog_size = 75M
# 安全配置 - MySQL 8.0兼容
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
[mysql]
default-character-set = utf8mb4
[client]
default-character-set = utf8mb4