X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage3%2Fmisc%2Fhv-config-mysql;fp=stage3%2Fmisc%2Fhv-config-mysql;h=ec2e774bf5453ef2e943f250379fa48be553e878;hb=d4f236d852479ef1b930f73a85084aa5bbc2d2a5;hp=0000000000000000000000000000000000000000;hpb=6531689d25d6ed05fcf872ae78d31643b00a00ff;p=hvlinux.git diff --git a/stage3/misc/hv-config-mysql b/stage3/misc/hv-config-mysql new file mode 100755 index 0000000..ec2e774 --- /dev/null +++ b/stage3/misc/hv-config-mysql @@ -0,0 +1,44 @@ +#!/bin/bash +set -o errexit + +# Script de configuration pour MySQL + +READ_VALID="no" + +while [ "${READ_VALID}" = "no" ]; do + echo "Do you want to set MySQL root password? (y/n): " + read SET_MYSQL_ROOT_PASS + + if [ "${SET_MYSQL_ROOT_PASS}" = "y" -o "${SET_MYSQL_ROOT_PASS}" = "n" ]; then + READ_VALID="yes" + else + echo "Error, answer y or n" + fi +done + +if [ "${SET_MYSQL_ROOT_PASS}" = "y" ]; then + # Make sure MySQL is started + /etc/rc.d/init.d/mysql start + + PASS_MATCH="no" + + while [ "${PASS_MATCH}" = "no" ]; do + echo -n "Enter new MySQL root password: " >&2 + read PASS1 + echo -n "Re-enter password to confirm : " >&2 + read PASS2 + + if [ "${PASS1}" != "${PASS2}" ]; then + echo "Error, passwords don't match" + else + PASS_MATCH="yes" + fi + done + + mysqladmin -u root password ${PASS1} + echo "MySQL root password set." + + echo "Shutting down MySQL server:" +fi + +exit $?