Windows 環境下 MySQL 服務重啟的圖形界面、命令列、批處理三種方式,並深度解析 Error 1040: Too many connections 根因(max_connections 與 wait_timeout 耦合),提供參數調優、連接池配置、應急重啟腳本的完整處置方案。
@echo off net stop mysql timeout /t 3 net start mysql echo MySQL service restarted. pause
[mysqld] max_connections = 2000 wait_timeout = 300 interactive_timeout = 300 max_user_connections = 1800 # 預留 200 給管理員 thread_cache_size = 100