Skip to content

Commit fd644d7

Browse files
committed
*: Support root account remote login for user management. #189
1 parent c9cc369 commit fd644d7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

config/samples/mysql_v1alpha1_cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
# restoreFrom:
1515

1616
mysqlOpts:
17-
rootPassword: ""
17+
rootPassword: "RadonDB@123"
1818
rootHost: localhost
1919
user: radondb_usr
2020
password: RadonDB@123

sidecar/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ func (cfg *Config) buildInitSql() []byte {
376376
CREATE DATABASE IF NOT EXISTS %s;
377377
DROP user IF EXISTS 'root'@'127.0.0.1';
378378
GRANT ALL ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY '%s' with grant option;
379+
DROP user IF EXISTS 'root'@'%%';
380+
GRANT ALL ON *.* TO 'root'@'%%' IDENTIFIED BY '%s' with grant option;
379381
DROP user IF EXISTS '%s'@'%%';
380382
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO '%s'@'%%' IDENTIFIED BY '%s';
381383
DROP user IF EXISTS '%s'@'%%';
@@ -385,7 +387,7 @@ GRANT SUPER, PROCESS, RELOAD, CREATE, SELECT ON *.* TO '%s'@'%%' IDENTIFIED BY '
385387
DROP user IF EXISTS '%s'@'%%';
386388
GRANT ALL ON %s.* TO '%s'@'%%' IDENTIFIED BY '%s';
387389
FLUSH PRIVILEGES;
388-
`, cfg.Database, cfg.RootPassword, cfg.ReplicationUser, cfg.ReplicationUser, cfg.ReplicationPassword,
390+
`, cfg.Database, cfg.RootPassword, cfg.RootPassword, cfg.ReplicationUser, cfg.ReplicationUser, cfg.ReplicationPassword,
389391
cfg.MetricsUser, cfg.MetricsUser, cfg.MetricsPassword, cfg.OperatorUser, cfg.OperatorUser,
390392
cfg.OperatorPassword, cfg.User, cfg.Database, cfg.User, cfg.Password)
391393

0 commit comments

Comments
 (0)