anxin-ruoyi/docker/database/init/00-mysql-config.sql
2026-01-05 01:46:20 +08:00

33 lines
997 B
SQL
Raw Permalink 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.

-- MySQL服务器配置脚本
-- 在数据库和表创建之前执行的配置
-- 设置MySQL服务器全局配置
-- 字符集配置
SET GLOBAL character_set_server = 'utf8mb4';
SET GLOBAL collation_server = 'utf8mb4_unicode_ci';
-- 时区配置
SET GLOBAL time_zone = '+8:00';
-- SQL模式配置兼容性设置
SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO';
-- 连接和性能配置
SET GLOBAL max_connections = 1000;
SET GLOBAL max_allowed_packet = 64*1024*1024; -- 64MB
SET GLOBAL innodb_buffer_pool_size = 128*1024*1024; -- 128MB
-- 日志配置
SET GLOBAL general_log = 'OFF';
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 2;
-- 二进制日志配置(用于复制和备份)
SET GLOBAL binlog_format = 'ROW';
SET GLOBAL expire_logs_days = 7;
-- 事务隔离级别
SET GLOBAL transaction_isolation = 'READ-COMMITTED';
-- 显示配置状态
SELECT 'MySQL server configuration completed' as ConfigStatus;