以下是我当前的环境状态,仍然无法连接到 http://path:3306 ;
我还需要检查什么?
[root@iZuf64ubd20239f6csewpqZ docker]# docker restart mysql-container
mysql-container
[root@iZuf64ubd20239f6csewpqZ docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8a3d7c29be43 mysql:5.7 "docker-entrypoint.s…" 45 minutes ago Up 2 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql-container
fa2bbec620d6 httpd "httpd-foreground" 2 hours ago Up 2 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp apache-container
30ab642eb0a4 peerjs/peerjs-server "node bin/peerjs --p…" 5 weeks ago Up 5 weeks 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp elegant_gates
[root@iZuf64ubd20239f6csewpqZ docker]# docker exec -it mysql-container mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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> SELECT user, host FROM mysql.user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| root | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
4 rows in set (0.00 sec)
mysql> SHOW GLOBAL VARIABLES LIKE 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.01 sec)
先登录到服务器,127.0.0.1可以连接吗,阿里云服务器文档也可以看一下MySQL给的连接例子,先按照它的步骤试试看环境,再不行还可以提交工单,专业工程师很快就能解决