Failed to connect to database: Access denied for user – Database Console SSL configuration unresolved
0 reputation · 06 Aug 2023, 12:59 UTC
0 reputation · 06 Aug 2023, 12:59 UTC
The IntelliJ IDEA Database Console displays the error "Failed to connect to database: Access denied for user" when the supplied username or password does not match the database’s credentials or is omitted entirely. This message is documented and appears consistently across recent releases.
When a target database is configured to require SSL, the Database Console does not automatically prompt for SSL settings. Instead, IntelliJ shows a warning that an SSL connection is not configured but still attempts the connection, potentially leading to insecure traffic or a failed handshake.
There is no documented automatic wizard that guides users to enable SSL during the connection setup, and the decision to enforce SSL configuration remains unresolved in the current IntelliJ releases.
To clarify the behavior, the following questions need to be answered:
33775 reputation · 06 Aug 2023, 16:32 UTC
When the IntelliJ Database Console reports "Failed to connect to database: Access denied for user" and the target database requires SSL, the most common cause is that the data‑source is connecting over plain TCP while the server’s account is created with REQUIRE SSL (MySQL) or SSLMODE=REQUIRED (PostgreSQL). IntelliJ does not provide an automatic wizard to enable SSL; the user must explicitly enable the SSL toggle or add the appropriate driver property to the JDBC URL.
sslMode=PREFERRED (MySQL) or sslmode=prefer (PostgreSQL), so the driver will attempt TLS if the server advertises support. If the driver is configured with useSSL=false or the URL lacks sslmode, the handshake will be plaintext.Use SSL checkbox (or Use SSH tunnel if you’re using SSH). For MySQL, you can also add sslMode=REQUIRED to the JDBC URL. For PostgreSQL, add sslmode=require.Open the Advanced tab and note the actual JDBC URL and driver version. For example, a MySQL URL might look like:
jdbc:mysql://db.example.com:3306/mydb?sslMode=REQUIRED
or a PostgreSQL URL like:
jdbc:postgresql://db.example.com:5432/mydb?sslmode=require
Ensure that the driver version bundled with IntelliJ matches the one that supports the chosen sslMode parameter.
using password: NO.'user'@'192.168.1.%'), the server will reject connections from other hosts even with correct credentials.caching_sha2_password plugin, a non‑TLS connection may fail due to public key retrieval restrictions, which can also surface as an access‑denied message.To narrow the issue further, please provide the full error line (including any driver‑specific text) and the database type (MySQL, PostgreSQL, SQL Server, etc.). These details determine whether the problem is purely credential‑based or involves SSL negotiation.
IntelliJ does not auto‑prompt for SSL; you must enable it manually in the data‑source settings or append the correct driver parameter to the JDBC URL. The “Access denied for user” error in this context usually indicates that the database account requires SSL and the connection was made over plaintext. Verify credentials, enable SSL, and test again. If the problem persists, share the complete error message and DBMS type for deeper analysis.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.