Clean root password Management
Don't store the root password. Provide easy replacement for mysql_pwd.py
This commit is contained in:
20
scripts/mariadbPwd
Normal file
20
scripts/mariadbPwd
Normal 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 $?
|
Reference in New Issue
Block a user