Skip to content

Commit 0619155

Browse files
committed
Update "test" database deletion code with extra query from mysql_secure_installation
1 parent b5a5d78 commit 0619155

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

.template.Debian/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ docker_setup_db() {
231231
read -r -d '' passwordSet <<-EOSQL || true
232232
DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;
233233
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
234+
235+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
236+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
237+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
238+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
239+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
240+
-- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6")
234241
EOSQL
235242
else
236243
# no, we don't care if read finds a terminating character in this heredoc (see above)

5.6/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ docker_setup_db() {
231231
read -r -d '' passwordSet <<-EOSQL || true
232232
DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;
233233
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
234+
235+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
236+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
237+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
238+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
239+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
240+
-- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6")
234241
EOSQL
235242
else
236243
# no, we don't care if read finds a terminating character in this heredoc (see above)

5.7/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ docker_setup_db() {
231231
read -r -d '' passwordSet <<-EOSQL || true
232232
DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;
233233
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
234+
235+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
236+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
237+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
238+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
239+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
240+
-- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6")
234241
EOSQL
235242
else
236243
# no, we don't care if read finds a terminating character in this heredoc (see above)

8.0/docker-entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ docker_setup_db() {
231231
read -r -d '' passwordSet <<-EOSQL || true
232232
DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;
233233
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
234+
235+
-- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210
236+
-- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236
237+
-- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818
238+
-- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749
239+
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
240+
-- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6")
234241
EOSQL
235242
else
236243
# no, we don't care if read finds a terminating character in this heredoc (see above)

0 commit comments

Comments
 (0)