If you are initializing a database from the command-line with a custom username/role (-r) and password (-w), ensure that you have created a corresponding PostgreSQL user for the same. Otherwise you may encounter error messages as shown below:
User authentication failure
You may also face another problem similar to this situation:
Database connection failure
In this case, check if the service postgresql-9.0 - PostgreSQL Server 9.0 is running in the Services Manager (Control Panel ‣ System and Security ‣ Administrative Tools ‣ Services).
PostgreSQL 9.0 in the Services list
You can edit the service configuration to start PostgreSQL as a service on system boot. This is usually the default.
Configure PostgreSQL 9.0 service
If your PostgreSQL service is running, but you get connection errors, you can restart the service.
Restarting the service