问答详情
源自:-

连接mysql问题

1.在容器内mysql正常可以访问使用root账号

root@f4ba8709f955:/bin# /usr/bin/mysql -uroot -p000000

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 10

Server version: 8.0.17 MySQL Community Server - GPL

Copyright (c) 2000, 2019, 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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| jpress             |

| mysql              |

| performance_schema |

| sys                |


在宿主机上无法访问

tcp46      0      0  *.3309                 *.*                    LISTEN     

tcp4       0      0  10.26.92.249.60638     10.26.92.249.3309      TIME_WAIT  

tcp4       0      0  10.26.92.249.60639     10.26.92.249.3309      TIME_WAIT  

tcp4       0      0  10.26.92.249.60640     10.26.92.249.3309      TIME_WAIT  

mysql是启动的

f4ba8709f955        mysql               "docker-entrypoint.s…"   5 minutes ago       Up 5 minutes        33060/tcp, 0.0.0.0:3309->3306/tcp   brave_dijkstra


提问者:慕妹5443444 2019-09-06 18:17

个回答