#!/bin/bash # # Renew MariaDB root password # Just like old (mysql_pwd.py) # cmd="mysql" options='--defaults-file=/etc/mysql/debian.cnf' role=$(CreoleGet dbClusterRole 'Leader') if [[ ${role} == "Leader"]] then 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 echo "This command don't work in a MariaDB Cluster Node, try in the Leader" exit 3 fi