Clean root password Management

Don't store the root password.
Provide easy replacement for mysql_pwd.py
This commit is contained in:
2018-04-12 16:01:43 +02:00
parent 2f4eca027a
commit 1dc370fb94
4 changed files with 45 additions and 35 deletions

20
scripts/mariadbPwd Normal file
View File

@ -0,0 +1,20 @@
#!/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 $?