天天看点

mysql设置最大连接数 max_connections

mysql 5.7版本的配置文件为:/etc/mysql/mysql.conf.d/mysqld.cnf

查看最大连接数:

mysql> show variables like '%connection%';
+--------------------------+-----------------+
| Variable_name            | Value           |
+--------------------------+-----------------+
| character_set_connection | utf8            |
| collation_connection     | utf8_general_ci |
| max_connections          | 151             |
| max_user_connections     | 0               |
+--------------------------+-----------------+
4 rows in set (0.49 sec)      
mysql> set GLOBAL max_connections=2000;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%connection%';
+--------------------------+-----------------+
| Variable_name            | Value           |
+--------------------------+-----------------+
| character_set_connection | utf8            |
| collation_connection     | utf8_general_ci |
| max_connections          | 2000            |
| max_user_connections     | 0               |
+--------------------------+-----------------+
4 rows in set (0.00 sec)