Philippe Caseiro
1dc370fb94
Don't store the root password. Provide easy replacement for mysql_pwd.py
20 lines
358 B
Bash
20 lines
358 B
Bash
#!/bin/bash
|
|
#
|
|
# Renew MariaDB root password
|
|
# Just like old (mysql_pwd.py)
|
|
#
|
|
cmd="mysql"
|
|
options='--defaults-file=/etc/mysql/debian.cnf'
|
|
|
|
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 $? |