-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup usage of FLUSH PRIVILEGES #15700
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
# This file is executed immediately after initializing a fresh data directory. | ||
|
||
############################################################################### | ||
# WARNING: This sql is *NOT* safe for production use, | ||
# as it contains default well-known users and passwords. | ||
# Care should be taken to change these users and passwords | ||
# for production. | ||
############################################################################### | ||
|
||
############################################################################### | ||
# Equivalent of mysql_secure_installation | ||
############################################################################### | ||
# We need to ensure that super_read_only is disabled so that we can execute | ||
# these commands. Note that disabling it does NOT disable read_only. | ||
# We save the current value so that we only re-enable it at the end if it was | ||
# enabled before. | ||
|
||
SET @original_super_read_only=IF(@@global.super_read_only=1, 'ON', 'OFF'); | ||
SET GLOBAL super_read_only='OFF'; | ||
|
||
# Changes during the init db should not make it to the binlog. | ||
# They could potentially create errant transactions on replicas. | ||
SET sql_log_bin = 0; | ||
# Remove anonymous users. | ||
DELETE FROM mysql.user WHERE User = ''; | ||
|
||
# Disable remote root access (only allow UNIX socket). | ||
DELETE FROM mysql.user WHERE User = 'root' AND Host != 'localhost'; | ||
# Remove anonymous users & disable remote root access (only allow UNIX socket). | ||
DROP USER IF EXISTS ''@'%', ''@'localhost', 'root'@'%'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically this statement is not equivalent to the original one, because it will not remove e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shlomi-noach yeah, I don’t think they normally would exist by default right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right. I think it's good to merge. |
||
|
||
# Remove test database. | ||
DROP DATABASE IF EXISTS test; | ||
|
@@ -78,8 +70,6 @@ GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD | |
GRANT SELECT, UPDATE, DELETE, DROP | ||
ON performance_schema.* TO 'vt_monitoring'@'localhost'; | ||
|
||
FLUSH PRIVILEGES; | ||
|
||
RESET SLAVE ALL; | ||
RESET MASTER; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,8 @@ SET GLOBAL super_read_only='OFF'; | |
# Changes during the init db should not make it to the binlog. | ||
# They could potentially create errant transactions on replicas. | ||
SET sql_log_bin = 0; | ||
# Remove anonymous users. | ||
DELETE FROM mysql.user WHERE User = ''; | ||
# Disable remote root access (only allow UNIX socket). | ||
DELETE FROM mysql.user WHERE User = 'root' AND Host != 'localhost'; | ||
# Remove anonymous users & disable remote root access (only allow UNIX socket). | ||
DROP USER IF EXISTS ''@'%', ''@'localhost', 'root'@'%'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. Not a concern as these are |
||
# Remove test database. | ||
DROP DATABASE IF EXISTS test; | ||
############################################################################### | ||
|
@@ -70,7 +68,7 @@ GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, FILE, | |
LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, | ||
SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER | ||
ON *.* TO 'vt_filtered'@'localhost'; | ||
FLUSH PRIVILEGES; | ||
|
||
RESET SLAVE ALL; | ||
RESET MASTER; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep this warning? We no longer have static secrets in this file anymore, which is a really good thing so the current warning is no longer accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can/should remove it.