That could happen if you haven't created an authentication configuration for your connection. You could also use basic authentication method, as described in the docs, but that is not secure - your password would be stored in plain text. See detailed description of QGIS authentication workflows.
I would suggest to create a new authentication configuration:
Specify user name and password for your database:
Set that authentication configuration for your connection:
Hope this helps!