mysql too many open connections問題解決方法
曾經(jīng)以為在my.cnf寫入max_connections = 2000
就可以改變mysql的最大并發(fā)量,今天查到一個命令,發(fā)現(xiàn)服務(wù)器的mysql最大連接數(shù)為151.
控制臺,連接上mysql
show variables;
這條命令可以看到所有基礎(chǔ)配置
如果單獨(dú)看max_connections可以這樣
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默認(rèn)的最大連接數(shù)。
my.cnf里大致這樣寫的
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
就好了。
說明這配置必須在[mysqld]下面,才有用。
相關(guān)文章
MySQL索引的優(yōu)化之LIKE模糊查詢功能實(shí)現(xiàn)
這篇文章主要介紹了MySQL索引的優(yōu)化之LIKE模糊查詢功能實(shí)現(xiàn),本文通過示例代碼給大家介紹的非常詳細(xì),感興趣的朋友一起看看吧2025-04-04
在數(shù)據(jù)庫里將毫秒轉(zhuǎn)換成date格式的方法
經(jīng)常會將日期時間的毫秒數(shù)存放到數(shù)據(jù)庫,但是它對應(yīng)的時間看起來就十分不方便,可以使用一些函數(shù)將毫秒轉(zhuǎn)換成date格式2014-05-05
getdata table表格數(shù)據(jù)join mysql方法
今天小編就為大家分享一篇關(guān)于getdata table表格數(shù)據(jù)join mysql方法,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2019-02-02
安裝使用Percona XtraBackup來備份恢復(fù)MySQL的教程
這篇文章主要介紹了安裝使用Percona XtraBackup來備份恢復(fù)MySQL的教程,文中的示例環(huán)境基于CentOS系統(tǒng),需要的朋友可以參考下2015-12-12
如何解決Mysql報錯Deadlock found when trying to
這篇文章主要介紹了如何解決Mysql報錯Deadlock found when trying to get lock;try restarting transaction問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-05-05
mysql字符串拼接并設(shè)置null值的實(shí)例方法
在本文中小編給大家整理的是關(guān)于mysql 字符串拼接+設(shè)置null值的實(shí)例內(nèi)容以及具體方法,需要的朋友們可以學(xué)習(xí)下。2019-09-09

