Невозможно изменить max_connections в mysql 5.7

Есть идеи, почему я не могу изменить 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

0
задан 4 February 2019 в 18:16
1 ответ

Лучший способ изменить этот параметр - отредактировать файл my.cnf

[mysqld]
max_connections=1000

, а затем перезапустить сервер MySQL.

0
ответ дан 5 December 2019 в 04:19

Теги

Похожие вопросы