萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 程式設計 >  >> 資料庫 >> MySQL 教學

Windows 下重啟 MySQL 服務的三種方法與 Too many connections 處理

方法一:服務管理員(GUI)

「我的電腦」→ 右鍵「管理」→ 「服務與應用程式」→ 「服務」→ 找到 MySQL → 右鍵「重新啟動」/「停止」/「啟動」。

方法二:命令列

net stop mysql
net start mysql

可存為 mysqlreset.bat 一鍵執行。

方法三:Linux 系統

service mysqld start|stop|restart

錯誤 1040:Too many connections

原因:連線數超過 max_connections,且 wait_timeout 過長導致閒置連線堆積。

解決:修改 my.ini (Windows) 或 my.cnf (Linux):

[mysqld]
max_connections = 1000
wait_timeout = 5

修改後重啟 MySQL。若頻繁發生,請檢查應用程式連線池設定、是否正確釋放連線。

copyright © 萬盛學電腦網 all rights reserved