# Accessing External MySQL DB inside Keycloak Docker Container

**URL:** <https://forum.keycloak.org/t/accessing-external-mysql-db-inside-keycloak-docker-container/7173>\
**Category:** Configuring the server\
**Created:** [February 4, 2021, 2:21pm UTC](https://forum.keycloak.org/t/accessing-external-mysql-db-inside-keycloak-docker-container/7173 "2021-02-04T14:21:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amrsaeedhosny](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/amrsaeedhosny/32/2173_2.png) [@amrsaeedhosny](https://forum.keycloak.org/u/amrsaeedhosny)\
**Post date:** [February 4, 2021, 2:21pm UTC](https://forum.keycloak.org/t/accessing-external-mysql-db-inside-keycloak-docker-container/7173/1 "2021-02-04T14:21:54Z")

</div>

I’m trying to access a remote DB inside Keycloak docker container with the following command:

`docker run -p 8080:8080 -e DB_VENDOR=mysql -e DB_ADDR=xx.xxx.xxx.xxx -e DB_PORT=3306 -e DB_DATABASE=keycloak -e DB_USER=keycloak -e DB_PASSWORD=keycloak jboss/keycloak`

When I run the command it raises an error:  
`Caused by: java.sql.SQLException: Access denied for user 'keycloak'@'156.208.161.15' (using password: YES)`

Notice that 156.208.161.15 is not the IP written at DB\_ADDR. I don’t know why the container accesses the DB using this IP.

So what do you think the problem is?

---

<div class="post-metadata">

**Author:** ![hmoun94](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/hmoun94/32/9188_2.png) [@hmoun94](https://forum.keycloak.org/u/hmoun94)\
**Post date:** [October 26, 2023, 9:22pm UTC](https://forum.keycloak.org/t/accessing-external-mysql-db-inside-keycloak-docker-container/7173/2 "2023-10-26T21:22:53Z")

</div>

i have the same problem  
did you resolve it ?
