MySQL password changing
[hcoop/domtool2.git] / src / plugins / domtool-mysql
index 02dcefa..d2c5298 100755 (executable)
@@ -17,6 +17,12 @@ case $1 in
 
                sudo -H mysql -e "CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$PASSWORD';"
        ;;
 
                sudo -H mysql -e "CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$PASSWORD';"
        ;;
+       passwd)
+               USERNAME=$2
+               PASSWORD=$3
+
+               sudo -H mysql -e "SET PASSWORD FOR '$USERNAME'@'localhost' = PASSWORD('$PASSWORD');"
+       ;;
        createdb)
                USERNAME=$2
                DBNAME_BASE=$3
        createdb)
                USERNAME=$2
                DBNAME_BASE=$3
@@ -40,6 +46,6 @@ case $1 in
                sudo -H mysql -e "FLUSH PRIVILEGES;"
        ;;
        *)
                sudo -H mysql -e "FLUSH PRIVILEGES;"
        ;;
        *)
-               echo "Usage: domtool-mysql [adduser <user> <password> | createdb <user> <table>]"
+               echo "Usage: domtool-mysql [adduser <user> <password> | passwd <user> <password> | createdb <user> <table>]"
        ;;
 esac
        ;;
 esac