mysql5.7+maxconnect,MySQL 5.7中的max_connections

I met a problem, the value of max_connction in MySQL is 214 after I set it 1000 via edit the my.cnf, just like below:

hadoop@node1:~$ mysql -V

mysql Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using EditLine wrapper

MySQL version: 5.7

OS version : ubuntu 16.04LTS

mysql> show variables like 'max_connections';

+-----------------+-------+

| Variable_name | Value |

+-----------------+-------+

| max_connections | 151 |

+-----------------+-------+

1 row in set (0.00 sec)

As we can see, the variable value of max_connections is 151. Then , I edit the configuration file of MySQL.

yang2@node1:~$ sudo vi /etc/mysql/my.cnf

[mysqld]

character-set-server=utf8

collation-server=utf8_general_ci

max_connections=1000

Restart MySQL service after save the configraion.

yang2@node1:~$ service mysql restart

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===

Authentication is required to restart 'mysql.service'.

Multiple identities can be used for authentication:

1. yangqiang,,, (yang2)

2. ,,, (hadoop)

Choose identity to authenticate as (1-2): 1

Password:

==== AUTHENTICATION COMPLETE ===

yang2@node1:~$

Now, we guess the max_connection is 1000, really?

mysql> show variables like 'max_connections';

+-----------------+-------+

| Variable_name | Value |

+-----------------+-------+

| max_connections | 214 |

+-----------------+-------+

1 row in set (0.00 sec)

It is 214. I do not really understand this result, who can help me? thx!

解决方案

As MySQL documentation on max_connections setting says:

Increasing this value increases the number of file descriptors that

mysqld requires. If the required number of descriptors are not

available, the server reduces the value of max_connections.

This means that probably your MySQL server does not have enough resources to maintain the required number of descriptors.

MySQL documentation on How MySQL Opens and Closes Tables makes it clear that:

The table_open_cache and max_connections system variables affect the

maximum number of files the server keeps open. If you increase one or

both of these values, you may run up against a limit imposed by your

operating system on the per-process number of open file descriptors.

Many operating systems permit you to increase the open-files limit,

although the method varies widely from system to system. Consult your

operating system documentation to determine whether it is possible to

increase the limit and how to do so.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值