Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to connect from Intellij to mySql running in docker container - "specified database user/password combination is rejected"

Currently unable to connect from Intellij to mySql running locally on docker container on ubuntu.

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| tasklogs           |
+--------------------+

+----------+-----------+------+
| DATABASE | HOST      | USER |
+----------+-----------+------+
| tasklogs | localhost | dev  |
| tasklogs | localhost | root |
+----------+-----------+------+

+-----------------------------------------------------------+
| Grants for dev@localhost                                  |
+-----------------------------------------------------------+
| GRANT USAGE ON *.* TO `dev`@`localhost`                   |
| GRANT ALL PRIVILEGES ON `tasklogs`.* TO `dev`@`localhost` |
+-----------------------------------------------------------+

docker ps -a:

enter image description here

When I connect via intellij:

enter image description here

i.e. "The specified database user/password combination is rejected: [28000][1045] Access denied for user 'dev'@'localhost' (using password: YES)"

I am putting in the right password.

Any help really appreciated.

Thanks,

like image 856
Hurricane Avatar asked Feb 01 '19 01:02

Hurricane


1 Answers

Solution

You didn't map your port with the localhost so you can't use localhost this is why couldn't do it

ports:
  - "3306:3306"
like image 170
Sayf-Eddine Avatar answered Oct 02 '22 15:10

Sayf-Eddine