Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL)
Description
This issue points out a difference between MySQL and MariaDB, where MySQL seems to have the expected behavior. When you update MAX_CONNECTIONS_PER_HOUR for a user the change can be seen in the users table, but in MariaDB it has no effect in practice. A blocked user will still not be able to connect. This can have serious consequences in production.
With MySQL 8.0.13 the ALTER actually lets new clients connect with the account, but with MariaDB 10.2.19 it does not. See the attached text file for a simple repro case with Docker.
I've also tested to change the limit using the following statements, but with the same result:
- UPDATE mysql.user SET max_connections = 0 WHERE user='testuser'; FLUSH PRIVILEGES;
- GRANT USAGE ON . TO 'site_devkit_live_index'@'%' WITH MAX_CONNECTIONS_PER_HOUR 0;
- Delete and re-create the user with a higher limit.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Updating MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
Works on MySQL 8.0.13 but not MariaDB 10.2.19. Tested both as standalone using the respective official docker image. To reproduce: {{docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:8.0.13@sha256:b7f7479f0a2e7a3f4ce008329572f3497075dc000d8b89bac3134b0fb0288de8 docker exec -ti mysql bash # in the container mysql -e "CREATE USER IF NOT EXISTS 'testuser'@'%' IDENTIFIED BY 'testuser' WITH MAX_CONNECTIONS_PER_HOUR 3;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = "ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3)" mysql -e "ALTER USER 'testuser'@'%' WITH MAX_CONNECTIONS_PER_HOUR 10;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = works again exit # outside the container docker kill mysql}} Now try the same experiment with MariaDB {{docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mariadb:10.2.19@sha256:8263e0a4a69ee6defdea16c48ed2c2243f086a5fed3febb2d062e6e938dc7c96}} {{root@82eff92299fd:/# mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3) root@82eff92299fd:/# mysql -e "USE mysql; SELECT host, user, max_user_connections, max_connections FROM user;" +-----------+----------+----------------------+-----------------+ | host | user | max_user_connections | max_connections | +-----------+----------+----------------------+-----------------+ | localhost | root | 0 | 0 | | % | testuser | 0 | 10 | +-----------+----------+----------------------+-----------------+}} |
Updating MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
Works on MySQL 8.0.13 but not MariaDB 10.2.19. Tested both as standalone using the respective official docker image. To reproduce: ``` docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:8.0.13@sha256:b7f7479f0a2e7a3f4ce008329572f3497075dc000d8b89bac3134b0fb0288de8 docker exec -ti mysql bash # in the container mysql -e "CREATE USER IF NOT EXISTS 'testuser'@'%' IDENTIFIED BY 'testuser' WITH MAX_CONNECTIONS_PER_HOUR 3;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = "ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3)" mysql -e "ALTER USER 'testuser'@'%' WITH MAX_CONNECTIONS_PER_HOUR 10;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = works again exit # outside the container docker kill mysql ``` Now try the same experiment with MariaDB {{docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mariadb:10.2.19@sha256:8263e0a4a69ee6defdea16c48ed2c2243f086a5fed3febb2d062e6e938dc7c96}} {{root@82eff92299fd:/# mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3) root@82eff92299fd:/# mysql -e "USE mysql; SELECT host, user, max_user_connections, max_connections FROM user;" +-----------+----------+----------------------+-----------------+ | host | user | max_user_connections | max_connections | +-----------+----------+----------------------+-----------------+ | localhost | root | 0 | 0 | | % | testuser | 0 | 10 | +-----------+----------+----------------------+-----------------+}} |
Attachment | MDEV-17852-repro.txt [ 46766 ] |
Description |
Updating MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
Works on MySQL 8.0.13 but not MariaDB 10.2.19. Tested both as standalone using the respective official docker image. To reproduce: ``` docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:8.0.13@sha256:b7f7479f0a2e7a3f4ce008329572f3497075dc000d8b89bac3134b0fb0288de8 docker exec -ti mysql bash # in the container mysql -e "CREATE USER IF NOT EXISTS 'testuser'@'%' IDENTIFIED BY 'testuser' WITH MAX_CONNECTIONS_PER_HOUR 3;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = "ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3)" mysql -e "ALTER USER 'testuser'@'%' WITH MAX_CONNECTIONS_PER_HOUR 10;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = works again exit # outside the container docker kill mysql ``` Now try the same experiment with MariaDB {{docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mariadb:10.2.19@sha256:8263e0a4a69ee6defdea16c48ed2c2243f086a5fed3febb2d062e6e938dc7c96}} {{root@82eff92299fd:/# mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3) root@82eff92299fd:/# mysql -e "USE mysql; SELECT host, user, max_user_connections, max_connections FROM user;" +-----------+----------+----------------------+-----------------+ | host | user | max_user_connections | max_connections | +-----------+----------+----------------------+-----------------+ | localhost | root | 0 | 0 | | % | testuser | 0 | 10 | +-----------+----------+----------------------+-----------------+}} |
Updating MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
Works on MySQL 8.0.13 but not MariaDB 10.2.19. Tested both as standalone using the respective official docker image. To reproduce: docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:8.0.13@sha256:b7f7479f0a2e7a3f4ce008329572f3497075dc000d8b89bac3134b0fb0288de8 docker exec -ti mysql bash # in the container mysql -e "CREATE USER IF NOT EXISTS 'testuser'@'%' IDENTIFIED BY 'testuser' WITH MAX_CONNECTIONS_PER_HOUR 3;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = "ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3)" mysql -e "ALTER USER 'testuser'@'%' WITH MAX_CONNECTIONS_PER_HOUR 10;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = works again exit # outside the container docker kill mysql Now try the same experiment with MariaDB docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mariadb:10.2.19@sha256:8263e0a4a69ee6defdea16c48ed2c2243f086a5fed3febb2d062e6e938dc7c96 root@82eff92299fd:/# mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3) root@82eff92299fd:/# mysql -e "USE mysql; SELECT host, user, max_user_connections, max_connections FROM user;" +-----------+----------+----------------------+-----------------+ | host | user | max_user_connections | max_connections | +-----------+----------+----------------------+-----------------+ | localhost | root | 0 | 0 | | % | testuser | 0 | 10 | +-----------+----------+----------------------+-----------------+ [^ |
Description |
Updating MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
Works on MySQL 8.0.13 but not MariaDB 10.2.19. Tested both as standalone using the respective official docker image. To reproduce: docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:8.0.13@sha256:b7f7479f0a2e7a3f4ce008329572f3497075dc000d8b89bac3134b0fb0288de8 docker exec -ti mysql bash # in the container mysql -e "CREATE USER IF NOT EXISTS 'testuser'@'%' IDENTIFIED BY 'testuser' WITH MAX_CONNECTIONS_PER_HOUR 3;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = "ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3)" mysql -e "ALTER USER 'testuser'@'%' WITH MAX_CONNECTIONS_PER_HOUR 10;" mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null # = works again exit # outside the container docker kill mysql Now try the same experiment with MariaDB docker run -d --rm --name mysql -e MYSQL_ROOT_HOST=localhost -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mariadb:10.2.19@sha256:8263e0a4a69ee6defdea16c48ed2c2243f086a5fed3febb2d062e6e938dc7c96 root@82eff92299fd:/# mysql -utestuser -ptestuser -e "SHOW DATABASES" > /dev/null ERROR 1226 (42000): User 'testuser' has exceeded the 'max_connections_per_hour' resource (current value: 3) root@82eff92299fd:/# mysql -e "USE mysql; SELECT host, user, max_user_connections, max_connections FROM user;" +-----------+----------+----------------------+-----------------+ | host | user | max_user_connections | max_connections | +-----------+----------+----------------------+-----------------+ | localhost | root | 0 | 0 | | % | testuser | 0 | 10 | +-----------+----------+----------------------+-----------------+ [^ |
Updating MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
Works on MySQL 8.0.13 but not MariaDB 10.2.19. Tested both as standalone using the respective official docker image. Edit: moved the repro case to an attached text file because I couldn't get proper preformatted in JIRA. [^ |
Description |
Updating MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
Works on MySQL 8.0.13 but not MariaDB 10.2.19. Tested both as standalone using the respective official docker image. Edit: moved the repro case to an attached text file because I couldn't get proper preformatted in JIRA. [^ |
When you update MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
With MySQL 8.0.13 the ALTER actually lets new clients connect with the account, but with MariaDB 10.2.19 it does not. See the attached text file for a simple repro case with Docker. [^ I've also tested to change the limit using the following statements, but with the same result: * UPDATE mysql.user SET max_connections = 0 WHERE user='testuser'; FLUSH PRIVILEGES; * GRANT USAGE ON *.* TO 'site_devkit_live_index'@'%' WITH MAX_CONNECTIONS_PER_HOUR 0; |
Description |
When you update MAX_CONNECTIONS_PER_HOUR has effect on the users table, but not in practice.
With MySQL 8.0.13 the ALTER actually lets new clients connect with the account, but with MariaDB 10.2.19 it does not. See the attached text file for a simple repro case with Docker. [^ I've also tested to change the limit using the following statements, but with the same result: * UPDATE mysql.user SET max_connections = 0 WHERE user='testuser'; FLUSH PRIVILEGES; * GRANT USAGE ON *.* TO 'site_devkit_live_index'@'%' WITH MAX_CONNECTIONS_PER_HOUR 0; |
This issue points out a difference between MySQL and MariaDB, where MySQL seems to have the expected behavior. When you update MAX_CONNECTIONS_PER_HOUR for a user the change can be seen in the users table, but in MariaDB it has no effect in practice. A blocked user will still not be able to connect. This can have serious consequences in production.
With MySQL 8.0.13 the ALTER actually lets new clients connect with the account, but with MariaDB 10.2.19 it does not. See the attached text file for a simple repro case with Docker. [^ I've also tested to change the limit using the following statements, but with the same result: * {{UPDATE mysql.user SET max_connections = 0 WHERE user='testuser'; FLUSH PRIVILEGES;}} * {{GRANT USAGE ON *.* TO 'site_devkit_live_index'@'%' WITH MAX_CONNECTIONS_PER_HOUR 0;}} * Delete and re-create the user with a higher limit. |
Attachment | test-max-user-connections.txt [ 46776 ] |
Summary | ALTER USER WITH MAX_CONNECTIONS_PER_HOUR has no effect | Altered connection limits for user have no effect |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Affects Version/s | 10.2 [ 14601 ] | |
Affects Version/s | 10.3 [ 22126 ] | |
Affects Version/s | 10.4 [ 22408 ] |
Labels | upstream-fixed |
Assignee | Sergei Golubchik [ serg ] |
Attachment | MDEV-17852-repro-docker-with-workaround.txt [ 46787 ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Fix Version/s | 10.2.37 [ 25112 ] | |
Fix Version/s | 10.3.28 [ 25111 ] | |
Fix Version/s | 10.4.18 [ 25110 ] | |
Fix Version/s | 10.5.9 [ 25109 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 90934 ] | MariaDB v4 [ 155282 ] |
We have the same issue for MAX_USER_CONNECTIONS as well. Attaching another repro case txt.
test-max-user-connections.txt