Mariadb: Cannot decrease max_connections to 1, ERROR 1231 (42000): Variable 'max_connections' can't be set to the value of '1' For doing updates on databases I reduce the max_connections variable to 1 (the remaining for root access). I found it the fastest solution to lock the database for other users during updating. This worked fine for me till yesterday. And I cannot find any restriction why it could be forbidden to set the value to 1. 

within my update script I used the command:

mysql -u root -p -e "SET @@global.max_connections = 1;"


and I get the errot:

ERROR 1231 (42000) at line 1: Variable 'max_connections' can't be set to the value of '1'


I tried to find the minimum number I'm allowed to set:

MariaDB [(none)]&gt; show variables like 'max_conn%';

-&gt; | max_connections    | 151   |

MariaDB [(none)]&gt; set @@global.max_connections=1;

ERROR 1231 (42000): Variable 'max_connections' can't be set to the value of '1'
MariaDB [(none)]&gt; set @@global.max_connections=10;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]&gt; set @@global.max_connections=9;

ERROR 1231 (42000): Variable 'max_connections' can't be set to the value of '9'

MariaDB [(none)]&gt; show variables like 'max_conn%';

-&gt; | max_connections    | 10    |


And I'm the single user on that database:

show status where `variable_name` = 'Threads_connected';

-&gt; | Threads_connected | 1     |
This sounds like a regression as the MariaDB documentation for max_connections says the range is 1 to 100000.

I can do SET GLOBAL max_connections=1; in MySQL 5.7 and 8.0, but not in MariaDB 10.2 and 10.3 (tested on 10.2.21, 10.3.10 and 10.3.12). I get a warning rather than an error, though:

| Warning | 1292 | Truncated incorrect max_connections value: '1' |


And the value gets set to 10:

SHOW GLOBAL VARIABLES LIKE 'max_connections';
-&gt; | max_connections | 10    |


(I've taken the liberty of reporting the issue here.)

EDIT

The documentation has been updated to say the range is now 10 to 100000, and the bug report has a comment from Monty himself explaining the reason for the change - it was deliberate, so not a bug. (Basically, it was done to prevent unexpected behaviour/results.)