# How do I fix the "Authentication Failed" error when connecting to PostgreSQL? ``` psql: FATAL: password authentication failed for user "your_username" ``` An `Authentication Failed` error occurs when: - You connect to the wrong database cluster. - You use the wrong username or password. If you are getting this error, check the cluster and username/password combination you’re using. To better review changes, we recommend the flags format to modify the connection string. For more on the flags format, see [How To Connect to PostgreSQL](https://docs.digitalocean.com/products/databases/postgresql/how-to/connect/index.html.md). ## Related Topics [How do I fix the "Connection Refused" error when connecting to my database?](https://docs.digitalocean.com/support/how-do-i-fix-the-connection-refused-error-when-connecting-to-my-database/index.html.md): Verify the connection string, ensure correct port usage, and add your local machine to the database cluster’s trusted sources. [How do I fix the "Connection Timed Out" error when connecting to my database?](https://docs.digitalocean.com/support/how-do-i-fix-the-connection-timed-out-error-when-connecting-to-my-database/index.html.md): Add your machine to the database cluster’s list of trusted sources in the firewall settings. [How do I fix the "Invalid Parameters and Values" error when connecting to my database?](https://docs.digitalocean.com/support/how-do-i-fix-the-invalid-parameters-and-values-error-when-connecting-to-my-database/index.html.md): Verify the format and values in the connection string for typos or formatting errors.