Sorry to resurrect a really old thread, but this was the only page I could find that was talking about a similar problem that I was having. I was attempting to upgrade from 4.0.0 to 4.0.1 and got these same errors.
End resolution was to 'chmod 777' the config file. I did have special characters in my MySQL password, but changing that did not resolve my issue.
Hopefully any one googling this issue will find this comment and save themselves a lot of wasted time.