Skip to content

Commit d4e405b

Browse files
committed
Added updating .my.cnf file when changing root password
1 parent 8dd1d4d commit d4e405b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bin/v-change-database-host-password

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ case $type in
4646
query="$query password=PASSWORD('$dbpass')"
4747
query="$query WHERE User='$dbuser';"
4848
query="$query FLUSH PRIVILEGES;"
49-
mysql_query "$query" ;;
49+
mysql_query "$query" ;
50+
if [ "$dbuser" == "root" ]; then
51+
echo -e "[client]\npassword='$dbpass'\n" > /root/.my.cnf
52+
chmod 600 /root/.my.cnf
53+
fi;;
5054
pgsql) echo "TBD" >/dev/null;;
5155
esac
5256

0 commit comments

Comments
 (0)