Skip to content

Commit

Permalink
mysql remote
Browse files Browse the repository at this point in the history
Remote access support for random password.
  • Loading branch information
QROkes committed Apr 28, 2022
1 parent 504dd5e commit d86ef6d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/webin
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ mysql_public_access() {
read -p "${blu}Master User Password: ${end}" pass
fi

[[ ${pass,,} == "random" ]] && local pass=`pwgen -s -1 16`

if [[ -z $user || -z $pass || $user == *"'"* || $pass == *"'"* || ${#pass} -lt 8 ]]; then
echo "${red}[ERROR] Please, enter a valid username and password!"
echo "Password can not contain a 'single quote' and must be at least 8 characters long.${end}"
Expand All @@ -313,7 +315,7 @@ GRANT ${priv} ON *.* TO '${user}'@'%' ${grant};
FLUSH PRIVILEGES;
_EOF_

[[ $? == 0 ]] && echo "${gre}${dim}Master User${blu} '${user}' ${gre}successfully created!${end}" || echo "${red}[ERROR] Unexpected error!${end}"
[[ $? == 0 ]] && echo "${gre}${dim}Master User${blu} $user ${gre}with password ${blu}${pass}${gre} successfully created!${end}" || echo "${red}[ERROR] Unexpected error!${end}"
fi

fi
Expand Down

0 comments on commit d86ef6d

Please sign in to comment.