I am trying to start MySQL using docker image, I wanted to have a look at the binlog files, however I couldn't find them in /var/lib/mysql
. From a few stackoverflow and Google reads, potential reason could be that mysql doesn't have permissions to write in /var/lib/mysql.
So I tried providing a different path using -v flag while starting the docker using the command docker run -it --rm --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=debezium -e MYSQL_USER=mysqluser -e MYSQL_PASSWORD=mysqlpw -v /home/username/mysql debezium/example-mysql:1.1
However, even after this, datadir variable in client still remains /var/lib/mysql. Can someone help me in this?
Using docker run -it --rm --name mysqlterm --link mysql --rm mysql:5.7 sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"
to start the MySQL client.
Asked
Active
Viewed 161 times
0

Raj Malhotra
- 89
- 1
- 11
1 Answers
0
You are running client on different container and expect yo find logs there?
if you want see log files, you should run docker exec mysql bash
, sometimes bash is not available, then use sh
.

Giga Kokaia
- 879
- 8
- 15
-
It's a different container, but it links with the first container using `--link mysql` – Raj Malhotra May 18 '20 at 10:16
-
I tried `docker exec mysql ls /home/username/mysql`, but still can't see logs there – Raj Malhotra May 18 '20 at 10:23
-
oh `docker exec mysql ls /var/lib/mysql` is showing the desired log files :D – Raj Malhotra May 18 '20 at 10:29
-
Noob Docker user here. – Raj Malhotra May 18 '20 at 10:30