made the mysql query compatible with v5.7

Updated the query according to 
https://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html
and
https://dev.mysql.com/doc/refman/5.7/en/set-password.html

to make it compatible with both mysql v5.6 and v5.7
This commit is contained in:
Mostafa Ghadamyari 2022-03-11 18:41:21 +03:30 committed by GitHub
commit c1e1521b42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,9 +42,9 @@ subj="v-change-database-host-password $*"
case $type in case $type in
mysql) mysql_connect $host; mysql) mysql_connect $host;
query="USE mysql; UPDATE user SET" query="SET PASSWORD FOR"
query="$query password=PASSWORD('$dbpass')" query="$query '$dbuser'@'localhost'"
query="$query WHERE User='$dbuser';" query="$query = PASSWORD('$dbpass');"
query="$query FLUSH PRIVILEGES;" query="$query FLUSH PRIVILEGES;"
mysql_query "$query" ; mysql_query "$query" ;
if [ "$dbuser" == "root" ]; then if [ "$dbuser" == "root" ]; then