《Mysql學習mysql too many open connections問題解決方法》要點:
本文介紹了Mysql學習mysql too many open connections問題解決方法,希望對您有用。如果有疑問,可以聯系我們。
曾經以為在my.cnf寫入max_connections = 2000
就可以改變mysql的最大并發量,本日查到一個命令,發現服務器的mysql最大連接數為151.MYSQL數據庫
控制臺,連接上mysql
MYSQL數據庫
代碼如下:
show variables;
這條命令可以看到所有基礎配置
如果單獨看max_connections可以這樣
MYSQL數據庫
代碼如下:
show variables like 'max%';
+―――――――――-+――――+
| Variable_name | Value |
+―――――――――-+――――+
| max_allowed_packet | 1048576 |
| max_binlog_cache_size | 4294963200 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 151 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20
151 好像是lampp默認的最大連接數.
my.cnf里大致這樣寫的
MYSQL數據庫
代碼如下:
max_connections=2000
# The MySQL server
[mysqld]
port??????????? = 3306
socket????????? = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
改完以后
代碼如下:
# The MySQL server
[mysqld]
max_connections=2000
port??????????? = 3306
然后把max_connections=2000移動到[mysqld]下面,重啟動mysql
代碼如下:
+―――――――――-+――――+
| Variable_name | Value |
+―――――――――-+――――+
| max_allowed_packet | 1048576 |
| max_binlog_cache_size | 4294963200 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 2000 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20
就好了.MYSQL數據庫
說明這配置必需在[mysqld]下面,才有用.MYSQL數據庫
歡迎參與《Mysql學習mysql too many open connections問題解決方法》討論,分享您的想法,維易PHP學院為您提供專業教程。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/13345.html