0

I am working through the Docker tutorial from here: https://docs.docker.com/language/python/develop/

I have done the first few steps from the tutorial to create a MYSQL container:

$ docker volume create mysql
$ docker volume create mysql_config
$ docker network create mysqlnet
$ docker run --rm -d -v mysql:/var/lib/mysql \
  -v mysql_config:/etc/mysql -p 3307:3306 \ 

### (note: I used 3307:3306 here instead of the specified 3306:3306 because port 3306 was already being used on my machine) ###

  --network mysqlnet \
  --name mysqldb \
  -e MYSQL_ROOT_PASSWORD=p@ssw0rd1 \
  mysql

I then followed the next step to check if the mysql container was running:

$  docker exec -ti mysqldb mysql -u root -p

the terminal then prompts:

Enter password:

and I am unable to enter anything. no commands seem to work. ctrl+C didn't even register. the only thing I could do was kill the terminal itself. I am very confused since I have been following the documentation very closely though I am sure it's something very dumb.

Thanks in advance!

3Ring
  • 49
  • 3
  • Are you sure the terminal is not receiving anything else? Have you tried to input any password and pressed enter just to check? Ensure it's not a password input with echo disabled. – Btc Sources Aug 06 '21 at 20:56
  • hey! yeah it does accept input when I hit enter. that spits me back to the normal terminal. However I have no idea if it's actually getting what I am typing because I tried entering "p@ssw0rd1" multiple times and I am getting: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) – 3Ring Aug 06 '21 at 21:00
  • Also I should mention when I entered the command with just '-i' and not '-ti' I was able to type and see my typing just fine. Though it still didn't accept the password. – 3Ring Aug 06 '21 at 21:06
  • Can't you change your `mysqldb` command for `/bin/bash` to access a regular terminal, and then open `mysqldb` once you've open a regular terminal? – Btc Sources Aug 06 '21 at 21:11
  • Are your 100% sure the `mysql` volume does not exist and contain a pre-existing db? (`docker volume create mysql` will silently ignore that). If this is the case, your db will not be initialized and your root password in environment will not be used (i.e. you have to enter the old previous root password). If you don't care about that data, I suggest you `docker volume rm` all those volumes and start from scratch to see if fixes your issue. Related read: https://stackoverflow.com/questions/59838692/mysql-root-password-is-set-but-getting-access-denied-for-user-rootlocalhost/59839180#59839180 – Zeitounator Aug 06 '21 at 21:17
  • Thanks Zeitounator, that was indeed the issue. However I am still confused as to why I can't see what I am typing. Is that normal? – 3Ring Aug 06 '21 at 22:02

1 Answers1

0

Try: $ docker exec -ti mysqldb bash then: mysql -u root -p I think you can connect with shell first

  • thanks for the thought, but I still can't see what I am writing this way. It does accept input however – 3Ring Aug 07 '21 at 12:56