I have the following initialization script:
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
CREATE USER IF NOT EXISTS 'developer'@'%' IDENTIFIED BY 'devpassword1';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON *.* TO 'developer'@'%';
CREATE USER IF NOT EXISTS 'maintainer'@'%' IDENTIFIED BY 'maintainerpw1';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON *.* TO 'maintainer'@'%';
FLUSH PRIVILEGES;
which I mount to a docker container running mariadb using the volume mounts in a docker-compose.yml file
services:
mariadb:
image: mariadb:10.7.3
container_name: sql-db
volumes:
- ./mariadb/init-scripts:/docker-entrypoint-initdb.d
Requirements
I am looking to grant developer and maintainer most of R/W grants but they MAY NOT create new users. That should be possible only via admin user.
Trials
I tried adding CREATE USER to both the maintainer/developer users and it works which what I do not wish to have.
This was possible by doing:
docker exec -it sql-db mariadb -u developer -p
docker exec -it sql-db mariadb -u maintainer -p
and in both cases CREATE USER dummy1@'%' actually creates the user.
Is there a fine tuning possible for mariadb Grants on user to let them create databases but not users?