mysql的max_connections和Too many connections
mysql中,max_connections表示最大連線數目, 可以修改(set GLOBAL max_connections = 3; 僅對mysql當前服務程式有效,如果mysql服務重啟,則失效)。 我修改為3了, 如下:
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 3 |
+-----------------+-------+
1 row in set (0.01 sec)
可以, 我發現, 實際上可以連線4個, 如下:
mysql> show status like 'Threads%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 0 |
| Threads_connected | 4 |
| Threads_created | 4 |
| Threads_running | 1 |
+-------------------+-------+
4 rows in set (0.00 sec)
mysql>
這是什麼原因呢?MySQL會保留一個用於管理員(SUPER)登陸的連線,用於管理員連線資料庫進行維護操作,即使當前連線數已經達到了max_connections。因此最大可連線數為max_connections+1, 所以可以有4個連線。繼續增加連線, 會怎樣呢?
ubuntu@VM-0-15-ubuntu:~$ sudo mysql -u root
ERROR 1040 (HY000): Too many connections
ubuntu@VM-0-15-ubuntu:~$
恩, 符合預期。
相關文章
- MySQL: Too many connectionsMySql
- MySQL ERROR 1040: Too many connectionsMySqlError
- 【MySQL】Too many connections 案例一則MySql
- 關於mysql的Too many connections問題MySql
- Mysql中too many connections問題的解決MySql
- 解決Mysql錯誤[1040]Too many connectionsMySql
- MySQL問題處理——1040錯誤Too many connectionsMySql
- 【MySql】修改max_connections引數的方法MySql
- 【MySql】修改max_connections 引數的方法MySql
- MYSQL max_user_connections back_log max_connections引數和Max_used_connectionsMySql
- mysql連線數設定操作(Too many connections)及設定md5值的加密密碼MySql加密密碼
- Mysql報Too many connections,不要亂用ulimit了,看看如何正確修改程式的最大檔案數MySqlMIT
- 連線雲虛擬主機中MySQL資料庫時出現“Too many connections”報錯資訊MySql資料庫
- max_connections引數對mysql初始化記憶體的影響MySql記憶體
- mysql備份提示 too many open files Errornumber 24MySqlError
- 解決 Too many symbol filesSymbol
- Too many open files in system處理
- Too many open files報錯處理
- [HP-UX] cannot fork: too many processesUX
- NETAPP - LOGIN TOO MANY USERSAPP
- when tag object too many, performance very lowObjectORM
- Too many files with unapproved license異常APP
- React報錯之Too many re-rendersReact
- titan-hadoop “Too many open files”修正Hadoop
- Ubuntu 解決 Too many open files 問題Ubuntu
- pg12 新特性,max_wal_senders 從 max_connections 分離
- AIX5.3: Too many processes 0403-030AI
- weblogic日誌報錯too many open filesWeb
- Nginx報錯: "Too many open files accept" 和 "could not build the server_names_hash"NginxUIServer
- 如何修復 SPF PermError: too many DNS lookupsErrorDNS
- 解決WebLogic中Too many open files異常Web
- MySQL異常刨析:ata source rejected establishment of connection, message from server: “Too many connectionMySqlServer
- nginx 報錯 accept4 () failed (24: Too many open files)NginxAI
- docker中使用systemctl命令時報Too many open files錯誤Docker
- ValueError: output parameter for reduction operation logical_and has too many dimensions ?Error
- linux Too Many Files 問題檢視和解決方法Linux
- 解決:ChatGPT too many requests in 1 hour.Try again laterChatGPTAI
- aix Oracle 使用者報錯:Too many processes already existAIOracle