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"