Unable to connect to database: Access denied for user

This error is bit complex:
Unable to connect to database: Access denied for user 'admin'@'localhost' (using password: YES)

It can mean that you changed database name, username, password or you are trying to connect to wrong server. If you are logged in an application, all these reasons are not possible. In case you are logged in, the problem is probably in your server connectivity - it can be overweight so you are sometimes not able to connect.