0

I have created a Docker container using the following command:

docker run --network host --name mariadb -e MYSQL_ROOT_PASSWORD=testpass -d mariadb:latest

I'm trying to connect to the MariaDB Docker container in my IntelliJ project and getting the following error:

The specified database user/password combination is rejected:
[28000][1045] Access denied for user 'root'@'127.0.0.1' (using password: YES)

When I run without --network host and use container's IP 172.18.0.2, I get the following error:

[08][-1] Could not connect to address=(host=172.18.0.2)(port=3306)(type=master) : connect timed out
java.net.SocketTimeoutException: connect timed out.

I even tried updating bind-address in my.cnf file in the container but no success.

Please help me.

Abdullah Khawer
  • 4,461
  • 4
  • 29
  • 66
  • Check this thread https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost – Andrey Sep 22 '19 at 16:57
  • better to verify the connection first inside container `docker exec -it mariadb bash -c " mysql -u root -ptestpass"` – Adiii Sep 22 '19 at 19:04

0 Answers0