OK. I'm going to try to explain the error to you one more time since you still don't seem to understand it.
"PunBB reported: Unable to connect to MySQL server. MySQL reported: Access denied for user 'user'@'localhost' (using password: YES)"
The problem there is that the username/password details you supplied for the MySQL server are incorrect. There is no way for PunBB to fix that, you simply need to enter correct details. The error is separate and apart from any other errors, such as a similar error you would get if you gave the correct username/password but your user did not have permission over a given database.
Then why it works in Linux properly?
Because you set things up properly there. It has nothing to do with the OS and everything to do with you entering details correctly.
I think it was about how to solve the problem, and the solution was kind of "manual".
Not about what is the exact reason beyond it, so that we could find an AUTOMATED solution.
How do you plan to automate adding a user to a MySQL server that you don't have correct login information for?
I think that there IS a solution out there that makes this boring error message DISAPPEAR for ever!!
Yes, using the correct login details