Fixed a problem of changing mysql passwords

There was a chicken and egg problem discussed in issue #5918:
"Setting mysql root password the first time"
Merge pull request #9722 from pakdel/issue-5918

Fixed a problem of changing mysql passwords