首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在MySQL5.7中更改max_connections

无法在MySQL5.7中更改max_connections
EN

Server Fault用户
提问于 2019-01-26 08:10:21
回答 1查看 315关注 0票数 0

知道为什么我不能在max_connections中改变MySQL。堆栈为:Ubuntu14.04和MySQL 5.7.15

代码语言:javascript
复制
mysql> select @@global.open_files_limit;
+---------------------------+
| @@global.open_files_limit |
+---------------------------+
|                     65535 |
+---------------------------+
1 row in set (0.00 sec)

mysql> select @@global.max_connections;
+--------------------------+
| @@global.max_connections |
+--------------------------+
|                      300 |
+--------------------------+
1 row in set (0.00 sec)

mysql> set @@global.max_connections = 1000;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.max_connections;
+--------------------------+
| @@global.max_connections |
+--------------------------+
|                      300 |
+--------------------------+
1 row in set (0.00 sec)

mysql> show variables like 'open_files_limit';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 65535 |
+------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 300   |
+-----------------+-------+
1 row in set (0.01 sec)

mysql> set global max_connections = 1000;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 300   |
+-----------------+-------+
1 row in set (0.00 sec)

mysql> show grants for root@localhost;
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

UPD:

代码语言:javascript
复制
cat /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log
open_files_limit = 8192
max_connections = 1000
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
transaction-isolation=READ-COMMITTED

UPD 2和解决方案:

在Django应用程序的设置中,我们找到了为什么数据库中的变量被阻塞的原因:

代码语言:javascript
复制
'init_command': 'SET default_storage_engine=INNODB, GLOBAL max_connections=300'

这不允许在MySQL中设置变量

EN

回答 1

Server Fault用户

发布于 2019-01-26 09:48:20

更改此参数的最佳方法是编辑my.cnf文件。

代码语言:javascript
复制
[mysqld]
max_connections=1000

然后重新启动MySQL服务器。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/950878

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档