step1: you need to the changed the default password of MySQL after the first install in docker container
docker logs <container_name or container_id>
docker logs <container_name or container_id> 2>&1 | grep GENERATED
step2:notedown default password
step3:
docker exec -it <container_name or container_id> mysql -uroot -p
Enter default password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
For more info of step1 to step 3 check here
step4:Add new user in mysql as username root and host any with password
create user 'root'@'%' identified by 'password';
step5:Grant all permission to that user
grant all privileges on *.* to 'root'@'%' with grant option;
For more info of step4 to step 5 check here
step 6: Exit from docker container: press ctrl+p+q
keys (not plus key combination of ctrl with p and q)
step7: suppose you are on hostmachine then
(else you give ipaddress of hostmachine instead of localhost)
telenet -l root localhost 3306
It asks for password enter password (we given password as password in step4)
press ctrl+]
key (not plus key combination of ctrl with ])
Telent connect successfully ..!!