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.