进入docker下的mysql
首先查看mysql容器的名称
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
95a11cbfab52 mysql:5.7 "docker-entrypoint.s…" 3 days ago Up 3 days 127.0.0.1:3306->3306/tcp, 33060/tcp aisa_arule3
查看mysql的container的ID是 95a11cbfab52 然后进入
进入容器
docker exec -it 95a11cbfab52 bash
进入容器后,终端前缀显示有变化
root@95a11cbfab52:/#
最后进入mysql
mysql -uroot -p
# Enter password:
最终出现:
mysql>
show databases;
use database;
show tables;