Mysql Too many connections
整理Mysql "Too many connections" 解決辦法_Curry_liang-CSDN博客
為了防止發生too many connections時候無法登錄的問題,mysql manual有如下的說明:
mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected.
因此, 必須只?賦予root用戶的SUPER權限,同時所有數據庫連接的帳戶不能賦予SUPER權限。前面說到的報錯后無法登錄就是由于我們的應用程序直接配置的root用戶
查看當前數據庫的所有用戶:
select user,host,password from mysql.user;
給用戶賦予super權限(super和ALL PRIVILEGES都可以):
GRANT super ON *.* TO 'mysql'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'localhost';
刪除用戶的super權限(super和ALL PRIVILEGES都可以):
REVOKE super ON *.* FROM 'mysql'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'mysql'@'localhost';
查看賦予用戶的權限
SHOW GRANTS FOR 'mysql'@'localhost';
微信掃一掃:關注我個人訂閱號“猿小飛”,更多精彩文章在這里及時發布:
?
總結
以上是生活随笔為你收集整理的Mysql Too many connections的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 查看线上环境中的jvm参数
- 下一篇: 多服务监听Redis key失效通知,并