[client] port = 3306 socket = /tmp/mysql.sock default-character-set = utf8mb4 [mysql] no-auto-rehash default-character-set = utf8mb4 [mysqld] # ==================================================================== # 1. PATHS & BASIC CORE SETTINGS # ==================================================================== user = mysql port = 3306 basedir = /usr/local/mysql datadir = /data/mysql socket = /tmp/mysql.sock pid-file = /data/mysql/mysql.pid # ==================================================================== # 2. GLOBAL INTERNATIONALIZATION (Supports ALL Languages + Emojis) # ==================================================================== character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init_connect = 'SET NAMES utf8mb4' # ==================================================================== # 3. 4GB RAM RESOURCE SAFEGUARDS & TUTOR BUDGETS # ==================================================================== # Disabling this saves ~400MB to 600MB of overhead instantly. performance_schema = 0 # Limit max connections to prevent RAM exhaustion if code loops infinitely. max_connections = 50 max_connect_errors = 1000 # Enforces strict, standardized ANSI SQL (forces students to code cleanly). sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY" # Explicit timeouts for idle tutorial connections interactive_timeout = 600 wait_timeout = 600 # ==================================================================== # 4. MEMORY ALLOCATIONS (Explicitly capped under 2GB Total) # ==================================================================== # Global Storage Buffers innodb_buffer_pool_size = 1G # Primary database buffer cache innodb_log_file_size = 128M # Redo log file size innodb_log_buffer_size = 8M # Transaction log buffer # Server Shared Metadata Buffers key_buffer_size = 16M max_allowed_packet = 32M table_open_cache = 1000 # Per-Thread Connection Buffers (Allocated per connection) sort_buffer_size = 512K # Used for ORDER BY actions join_buffer_size = 512K # Used for table JOIN actions read_buffer_size = 256K # Sequential scan buffer read_rnd_buffer_size = 512K # Random read sorting buffer # ==================================================================== # 5. STORAGE ENGINE CONFIGURATION (InnoDB Defaults) # ==================================================================== innodb_data_home_dir = /data/mysql innodb_log_group_home_dir = /data/mysql innodb_file_per_table = 1 # Isolates individual tables into standalone .ibd files innodb_flush_log_at_trx_commit = 2 # Speed preference over safety for testing/learning innodb_stats_on_metadata = 0 # ==================================================================== # 6. LOGGING ARCHITECTURE (Perfect for Teaching & Debugging) # ==================================================================== # General Diagnostic Error Logging log-error = /data/mysql/mysql-error.log # Slow Query Logging (Use to teach 'EXPLAIN' syntax and index optimization) slow_query_log = 1 slow_query_log_file = /data/mysql/mysql-slow.log long_query_time = 2 # Captures commands executing over 2 seconds # Binary Logging & Replication Basics server-id = 1 log-bin = /data/mysql/mysql-bin binlog_format = ROW expire_logs_days = 3 # Automatically wipes old binlogs to preserve disk space