(→확인) |
|||
(사용자 3명의 중간 판 12개는 보이지 않습니다) | |||
1번째 줄: | 1번째 줄: | ||
{{DISPLAYTITLE:MySQL max_connections 설정}} | |||
;MySQL Too many connections 오류 조치 | |||
;MySQL max_connections 설정 | ;MySQL max_connections 설정 | ||
==확인== | ==확인== | ||
<source lang=' | <source lang='console'> | ||
[root@zetadb ~]# mysql -uroot -p | [root@zetadb ~]# mysql -uroot -p | ||
... (생략) | ... (생략) | ||
13번째 줄: | 15번째 줄: | ||
1 row in set (0.00 sec) | 1 row in set (0.00 sec) | ||
</source> | </source> | ||
<source lang=' | <source lang='console'> | ||
mysql> show status like 'Max_used_connections'; | mysql> show status like 'Max_used_connections'; | ||
+----------------------+-------+ | +----------------------+-------+ | ||
22번째 줄: | 24번째 줄: | ||
1 row in set (0.00 sec) | 1 row in set (0.00 sec) | ||
</source> | </source> | ||
:→ max_connections 설정이 151인데 152개의 커넥션 발생 | :→ max_connections 설정이 151인데 152개의 커넥션 발생 | ||
:→ 초과분에 대해서는 Too many connections 오류 발생 | |||
<source lang='console'> | |||
mysql> show status like 'Aborted%'; | |||
+------------------+-------+ | |||
| Variable_name | Value | | |||
+------------------+-------+ | |||
| Aborted_clients | 4 | | |||
| Aborted_connects | 1 | | |||
+------------------+-------+ | |||
2 rows in set (0.00 sec) | |||
</source> | |||
:→ 클라이언트 차단 4건, 커넥션 차단 1건 발생했음 | |||
==온라인 설정== | ==온라인 설정== | ||
*즉시 적용됨 | *즉시 적용됨 | ||
<source lang=' | <source lang='console'> | ||
mysql> set global max_connections=500; | mysql> set global max_connections=500; | ||
Query OK, 0 rows affected (0.00 sec) | Query OK, 0 rows affected (0.00 sec) | ||
32번째 줄: | 46번째 줄: | ||
==확인 2== | ==확인 2== | ||
<source lang=' | <source lang='console'> | ||
mysql> show variables like 'max_connections'; | mysql> show variables like 'max_connections'; | ||
+-----------------+-------+ | +-----------------+-------+ | ||
45번째 줄: | 59번째 줄: | ||
*[[my.cnf]]에 max_connections 설정 추가 | *[[my.cnf]]에 max_connections 설정 추가 | ||
*mysqld 재시작시에 적용됨 | *mysqld 재시작시에 적용됨 | ||
<source lang=' | <source lang='console'> | ||
[root@zetadb ~]# vi /etc/my.cnf | [root@zetadb ~]# vi /etc/my.cnf | ||
</source> | </source> | ||
<source lang=' | <source lang='aconf'> | ||
[mysqld] | [mysqld] | ||
max_connections = 500 | max_connections = 500 | ||
55번째 줄: | 69번째 줄: | ||
==확인 3== | ==확인 3== | ||
*가능하면 MySQL 재시작하여 다시 확인 | *가능하면 MySQL 재시작하여 다시 확인 | ||
<source lang=' | <source lang='console'> | ||
[root@zetadb ~]# service mysqld restart | [root@zetadb ~]# service mysqld restart | ||
Stopping mysqld: [ OK ] | Stopping mysqld: [ OK ] | ||
Starting mysqld: [ OK ] | Starting mysqld: [ OK ] | ||
</source> | </source> | ||
<source lang=' | <source lang='console'> | ||
[root@zetadb ~]# mysql -uroot -p | [root@zetadb ~]# mysql -uroot -p | ||
... (생략) | ... (생략) | ||
73번째 줄: | 87번째 줄: | ||
==같이 보기== | ==같이 보기== | ||
*[[MySQL 환경변수]] | |||
*[[my.cnf]] | *[[my.cnf]] | ||
==참고 | ==참고== | ||
*http://threestory.tistory.com/6 | *http://threestory.tistory.com/6 | ||
[[분류: MySQL]] | [[분류: MySQL]] |
2020년 1월 20일 (월) 00:12 기준 최신판
- MySQL Too many connections 오류 조치
- MySQL max_connections 설정
1 확인[ | ]
Console
Copy
[root@zetadb ~]# mysql -uroot -p
... (생략)
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 151 |
+-----------------+-------+
1 row in set (0.00 sec)
Console
Copy
mysql> show status like 'Max_used_connections';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 152 |
+----------------------+-------+
1 row in set (0.00 sec)
- → max_connections 설정이 151인데 152개의 커넥션 발생
- → 초과분에 대해서는 Too many connections 오류 발생
Console
Copy
mysql> show status like 'Aborted%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| Aborted_clients | 4 |
| Aborted_connects | 1 |
+------------------+-------+
2 rows in set (0.00 sec)
- → 클라이언트 차단 4건, 커넥션 차단 1건 발생했음
2 온라인 설정[ | ]
- 즉시 적용됨
Console
Copy
mysql> set global max_connections=500;
Query OK, 0 rows affected (0.00 sec)
3 확인 2[ | ]
Console
Copy
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 500 |
+-----------------+-------+
1 row in set (0.00 sec)
4 영구 설정[ | ]
- my.cnf에 max_connections 설정 추가
- mysqld 재시작시에 적용됨
Console
Copy
[root@zetadb ~]# vi /etc/my.cnf
aconf
Copy
[mysqld]
max_connections = 500
5 확인 3[ | ]
- 가능하면 MySQL 재시작하여 다시 확인
Console
Copy
[root@zetadb ~]# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
Console
Copy
[root@zetadb ~]# mysql -uroot -p
... (생략)
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 500 |
+-----------------+-------+
1 row in set (0.00 sec)
6 같이 보기[ | ]
7 참고[ | ]
편집자 Jmnote Jmnote bot 175.113.182.190
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- MySQL (5)
CentOS MySQL 설치 ― …MySQL BigDump ― JmnoteMySQL STRICT TRANS TABLES ― John JeongMySQL 외래키 옵션 변경 ― 문태부MySQL 컬럼명으로 테이블 찾기 ― Stly3466