From 9755492b667e04d56590c3b25577938eb0af9e63 Mon Sep 17 00:00:00 2001 From: flytreeleft Date: Sun, 10 Mar 2019 10:38:46 +0800 Subject: [PATCH] Fix that creating 'root'@'' will be failed when MYSQL_ROOT_HOST isn't '%', 'FLUSH PRIVILEGES' needs to be executed after creating or updating any user. --- 5.5/docker-entrypoint.sh | 1 + 5.6/docker-entrypoint.sh | 1 + 5.7/docker-entrypoint.sh | 1 + 8.0/docker-entrypoint.sh | 1 + 4 files changed, 4 insertions(+) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index cd1855f3f..647619cfd 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -158,6 +158,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + FLUSH PRIVILEGES ; ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 7dbd6975a..46ebdbc00 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -158,6 +158,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + FLUSH PRIVILEGES ; ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index b38c11287..fe7a8cf9a 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -163,6 +163,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + FLUSH PRIVILEGES ; ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 720ef6d65..17248882d 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -165,6 +165,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + FLUSH PRIVILEGES ; ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ;