Mysql Too many connections
整理Mysql "Too many connections" 解決辦法_Curry_liang-CSDN博客
為了防止發(fā)生too many connections時(shí)候無(wú)法登錄的問(wèn)題,mysql manual有如下的說(shuō)明:
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權(quán)限,同時(shí)所有數(shù)據(jù)庫(kù)連接的帳戶不能賦予SUPER權(quán)限。前面說(shuō)到的報(bào)錯(cuò)后無(wú)法登錄就是由于我們的應(yīng)用程序直接配置的root用戶
查看當(dāng)前數(shù)據(jù)庫(kù)的所有用戶:
select user,host,password from mysql.user;
給用戶賦予super權(quán)限(super和ALL PRIVILEGES都可以):
GRANT super ON *.* TO 'mysql'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'localhost';
刪除用戶的super權(quán)限(super和ALL PRIVILEGES都可以):
REVOKE super ON *.* FROM 'mysql'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'mysql'@'localhost';
查看賦予用戶的權(quán)限
SHOW GRANTS FOR 'mysql'@'localhost';
微信掃一掃:關(guān)注我個(gè)人訂閱號(hào)“猿小飛”,更多精彩文章在這里及時(shí)發(fā)布:
?
總結(jié)
以上是生活随笔為你收集整理的Mysql Too many connections的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 查看线上环境中的jvm参数
- 下一篇: 多服务监听Redis key失效通知,并