Skip to content

Commit 6aaf2a7

Browse files
committed
Update "test" database deletion code with extra query from mysql_secure_installation
1 parent b39f1e5 commit 6aaf2a7

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

5.5/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,14 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
159159
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
160160
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
161161
${rootCreate}
162+
163+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
164+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
165+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
166+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
162167
DROP DATABASE IF EXISTS test ;
168+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
169+
163170
FLUSH PRIVILEGES ;
164171
EOSQL
165172

5.6/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,14 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
159159
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
160160
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
161161
${rootCreate}
162+
163+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
164+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
165+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
166+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
162167
DROP DATABASE IF EXISTS test ;
168+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
169+
163170
FLUSH PRIVILEGES ;
164171
EOSQL
165172

5.7/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,14 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
164164
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
165165
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
166166
${rootCreate}
167+
168+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
169+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
170+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
171+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
167172
DROP DATABASE IF EXISTS test ;
173+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
174+
168175
FLUSH PRIVILEGES ;
169176
EOSQL
170177

8.0/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,14 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
166166
ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
167167
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
168168
${rootCreate}
169+
170+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
171+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
172+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
173+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
169174
DROP DATABASE IF EXISTS test ;
175+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
176+
170177
FLUSH PRIVILEGES ;
171178
EOSQL
172179

0 commit comments

Comments
 (0)