Skip to content

Commit

Permalink
*: Support root account remote login for user management. #189
Browse files Browse the repository at this point in the history
  • Loading branch information
runkecheng committed Sep 22, 2021
1 parent c4bcfe0 commit b25c9cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/samples/mysql_v1alpha1_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
# restoreFrom:

mysqlOpts:
rootPassword: ""
rootPassword: "RadonDB@123"
rootHost: localhost
user: qc_usr
password: Qing@123
Expand Down
4 changes: 3 additions & 1 deletion sidecar/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ func (cfg *Config) buildInitSql() []byte {
CREATE DATABASE IF NOT EXISTS %s;
DROP user IF EXISTS 'root'@'127.0.0.1';
GRANT ALL ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY '%s' with grant option;
DROP user IF EXISTS 'root'@'%%';
GRANT ALL ON *.* TO 'root'@'%%' IDENTIFIED BY '%s' with grant option;
DROP user IF EXISTS '%s'@'%%';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO '%s'@'%%' IDENTIFIED BY '%s';
DROP user IF EXISTS '%s'@'%%';
Expand All @@ -385,7 +387,7 @@ GRANT SUPER, PROCESS, RELOAD, CREATE, SELECT ON *.* TO '%s'@'%%' IDENTIFIED BY '
DROP user IF EXISTS '%s'@'%%';
GRANT ALL ON %s.* TO '%s'@'%%' IDENTIFIED BY '%s';
FLUSH PRIVILEGES;
`, cfg.Database, cfg.RootPassword, cfg.ReplicationUser, cfg.ReplicationUser, cfg.ReplicationPassword,
`, cfg.Database, cfg.RootPassword, cfg.RootPassword, cfg.ReplicationUser, cfg.ReplicationUser, cfg.ReplicationPassword,
cfg.MetricsUser, cfg.MetricsUser, cfg.MetricsPassword, cfg.OperatorUser, cfg.OperatorUser,
cfg.OperatorPassword, cfg.User, cfg.Database, cfg.User, cfg.Password)

Expand Down

0 comments on commit b25c9cb

Please sign in to comment.