From 391678cb877d41bef92138db039d81b1adf2acd6 Mon Sep 17 00:00:00 2001 From: cxhong Date: Thu, 20 Feb 2020 13:35:28 -0500 Subject: [PATCH] mysqlsetup support for SLE15 x86_64 system --- xCAT-client/bin/mysqlsetup | 44 ++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 8c0f9832a..b9743c963 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -888,23 +888,25 @@ sub initmysqldb } } # end AIX only - #on debian/ubuntu should comment the bind-adress line in my.cnf + #bind-adress line in my.cnf should comment out #on Ubuntu16.04, the bind-address line is in the mariadb.conf.d/50-server.cnf - if ($::debianflag) { - my $bind_file; - if (-e "/etc/mysql/mariadb.conf.d/50-server.cnf") - { - $bind_file = "/etc/mysql/mariadb.conf.d/50-server.cnf"; - } else { - $bind_file = "/etc/mysql/my.cnf"; - } - $cmd = "sed 's/\\(^\\s*bind.*\\)/#\\1/' $bind_file > /tmp/my.cnf; mv -f /tmp/my.cnf $bind_file;chmod 644 $bind_file"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " comment the bind-address line in $bind_file failed: $cmd."); - exit(1); - } + #on SLE15, the bind-address line is in the /etc/my.cnf + my $bind_file; + if (-e "/etc/mysql/mariadb.conf.d/50-server.cnf") + { + $bind_file = "/etc/mysql/mariadb.conf.d/50-server.cnf"; + } elsif (-e "/etc/mysql/my.cnf") + { + $bind_file = "/etc/mysql/my.cnf"; + } else { + $bind_file = "/etc/my.cnf"; + } + $cmd = "sed 's/^bind/#&/' $bind_file > /tmp/my.cnf; mv -f /tmp/my.cnf $bind_file;chmod 644 $bind_file"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " comment the bind-address line in $bind_file failed: $cmd."); + exit(1); } # Create the MySQL data directory and initialize the grant tables @@ -1244,6 +1246,14 @@ sub setupxcatdb $grantall_localhost .= "\'"; $grantall_localhost .= " IDENTIFIED BY \'$::adminpassword\';\r"; + #GRAND root to host account + my $grantroot = ""; + $grantroot = "GRANT ALL on xcatdb.* TO root@"; + $grantroot .= "\'"; + $grantroot .= "$::MN"; + $grantroot .= "\'"; + $grantroot .= " IDENTIFIED BY \'$::rootpassword\';\r"; + # # -re $pwd_prompt # Enter the password for root @@ -1312,6 +1322,8 @@ sub setupxcatdb $mysql->clear_accum(); $mysql->send("$grantall_localhost"); $mysql->clear_accum(); + $mysql->send("$grantroot"); + $mysql->clear_accum(); $mysql->send("exit;\r"); }