centos 7.5 使用docker-compose部署mysql7.5后如何登录容器中操作mysql

在服务器上执行如下操作:

 # docker exec -it local_mysql_new  mysql -uroot -p

然后输入数据库密码即可

Enter password:

登录成功后的信息:

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 12
Server version: 5.7.29 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.

命令中的:local_mysql_new为mysql 数据的容器名

原文地址:https://www.cnblogs.com/edrp/p/12881093.html