2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

mysqlsetup support for SLE15 x86_64 system

This commit is contained in:
cxhong 2020-02-20 13:35:28 -05:00
parent 4dd2592381
commit 391678cb87

View File

@ -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");
}