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 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 | +-----------+----------+----------------------+-----------------+