Unable to connect to MySQL database in IntelliJ IDEA under Ubuntu 19.04 due to constant database login credential prompt.

Answered

I am trying to connect to a MySQL database in IntelliJ IDEA with the database tool, but it constantly gives me this error, despite that I give it the right details for the connection:
The specified database user/password combination is rejected: com.mysql.cj.exceptions.CJException: Access denied for user 'root'@'localhost'.

MySQL Server is installed on the system, but can only start it as a super user.

Is there any solution to this problem?

0
6 comments
Avatar
Yaroslav Bedrov

Hello Biro,

Are you trying to connect with empty password?
Did you checked "Remember password" checkbox?
Is your MySQL server configured to accept TC/IP connections?

Is it possible to share idea.log ("Help | Show Log in...") after restarting IDE and reproducing the issue?

0

Hi Yaroslav,

Thank you for your answer.

The mysql server runs on my computer, I have to connect to a local database.

I have tried to connect with both an empty password and root password from IntelliJ. The reason is weird thing: when I want to run mysql command line, I can only start it as a super user: sudo mysql, or sudo mysql -u root -p. In the first case, it doesn't even require a password, It just starts mysql command line. In the second case, it prompts for the sudo password, then for the root password, but for the latter I can type in anything as password, even just pressing enter starts the command line interface.

Yes it's possible to share the log file. Should I copy/paste it here, or I can upload it somewhere?

0
Avatar
Yaroslav Bedrov

Biro,

You could use any online file sharing service. Also please try to run IDE with sudo rights. 

0

Hi,

I have finally found the solution to my problem. I had a weird feeling that it's a problem with mysql and somehow I still turned to you for a solution. But it turned out that it really was an issue with the MySQL configuration.

Sorry if I bothered you.

If anyone else runs into this issue and may be wondering what's the solution I leave this SO answer here, because it solved my problem:

https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost

@Yaroslav:
Thank you for your time.

0
Avatar
Yaroslav Bedrov

You are welcome! Thanks for sharing solution.

0

Please sign in to leave a comment.