docker mysql 登录 记录

v_jsonchang@v_jsonchan-PC1 MINGW64 /f
$ docker ps
CONTAINER ID        IMAGE                                               COMMAND                  CREATED             STATUS              PORTS                               NAMES
63623021f5c1        mysql                                               "docker-entrypoint.s…"   5 months ago        Up 2 weeks          0.0.0.0:3306->3306/tcp, 33060/tcp   mysql-test

v_jsonchang@v_jsonchan-PC1 MINGW64 /f
$ mysql -uroot -p

v_jsonchang@v_jsonchan-PC1 MINGW64 /f
$ docker exec -it mysql-test
"docker exec" requires at least 2 arguments.
See 'docker exec --help'.

Usage:  docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

Run a command in a running container

v_jsonchang@v_jsonchan-PC1 MINGW64 /f
$ docker exec -it mysql-test bash
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

v_jsonchang@v_jsonchan-PC1 MINGW64 /f
$ ^C

v_jsonchang@v_jsonchan-PC1 MINGW64 /f
$ winpty docker exec -it mysql-test bash
root@63623021f5c1:/# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 143
Server version: 8.0.21 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

  

原文地址:https://www.cnblogs.com/zexin88/p/14525187.html