MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
770 stars 438 forks source link

Root user lacks grant privileges #362

Closed chongma closed 3 years ago

chongma commented 3 years ago

Somehow the root user has Grant_priv set to N

I have tried putting a file grant.sql containing

GRANT ALL PRIVILEGES on *.* TO 'root'@'%' WITH GRANT OPTION

in the /docker-entrypoint-initdb.d directory but it doesn't have any effect

grooverdan commented 3 years ago

The entrypoint only has an effect on uninitialized data directories.

Add a init-file configuration option pointing to your grant.sql file.

https://jira.mariadb.org/browse/MDEV-25030

chongma commented 3 years ago

Thanks. Yes I tried the init-file route without luck. In the end I created a new installation and copied the mysql schema into my old one. i just needed to add back the users manually. Not sure how it got in that state

grooverdan commented 3 years ago

It occurs to me that [docker|podman] run -v entry:/docker-entrypoint-initdb.d -v data:/var/lib/mysql --init-file=/docker-entrypoint-initdb.d/grant.sql may have been simpler.

mysqldump --system=users is a way to get the users and grants with minimal manual work.