1. 查看docker容器列表 docker ps 拿到container id 2. 进入容器 docker exec -it <container_name_or_id> bash 3. 然后就可以使用mysql命令了