知道为什么我不能在max_connections中改变MySQL。堆栈为:Ubuntu14.04和MySQL 5.7.15
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:
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-COMMITTEDUPD 2和解决方案:
在Django应用程序的设置中,我们找到了为什么数据库中的变量被阻塞的原因:
'init_command': 'SET default_storage_engine=INNODB, GLOBAL max_connections=300'这不允许在MySQL中设置变量
发布于 2019-01-26 09:48:20
更改此参数的最佳方法是编辑my.cnf文件。
[mysqld]
max_connections=1000然后重新启动MySQL服务器。
https://serverfault.com/questions/950878
复制相似问题