Correct management of leadership
This commit is contained in:
@ -6,15 +6,23 @@
|
||||
cmd="mysql"
|
||||
options='--defaults-file=/etc/mysql/debian.cnf'
|
||||
|
||||
if [[ -z ${1} ]]
|
||||
role=$(CreoleGet dbClusterRole 'Leader')
|
||||
|
||||
if [[ ${role} == "Leader"]]
|
||||
then
|
||||
read -s -p "New Password : " password
|
||||
echo
|
||||
if [[ -z ${1} ]]
|
||||
then
|
||||
read -s -p "New Password : " password
|
||||
echo
|
||||
else
|
||||
password="${1}"
|
||||
fi
|
||||
|
||||
sql="FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '${password}';"
|
||||
|
||||
${cmd} ${options} -e "${sql}"
|
||||
exit $?
|
||||
else
|
||||
password="${1}"
|
||||
fi
|
||||
|
||||
sql="FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '${password}';"
|
||||
|
||||
${cmd} ${options} -e "${sql}"
|
||||
exit $?
|
||||
echo "This command don't work in a MariaDB Cluster Node, try in the Leader"
|
||||
exit 3
|
||||
fi
|
Reference in New Issue
Block a user