Любые идеи, почему я не могу изменить max_connections в MySQL. Стек: Ubuntu 14.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-COMMITTED
UPD 2 и РЕШЕНИЕ:
Мы выяснили, почему переменная заблокирована в базе данных, в настройках приложения Django у нас есть:
'init_command': 'SET default_storage_engine=INNODB, GLOBAL max_connections=300'
и это не позволяет установить переменную в MySQL
Лучший способ изменить этот параметр - отредактировать my.cnf
файл
[mysqld]
max_connections=1000
а затем перезапустите сервер MySQL.