为什么有这篇博客
昨天购买了阿里云的ecs服务器,通过xshell安装了docker,然后在docker环境中安装mysql,版本是8.0.21。开始一切顺利,在服务器环境中能正常执行各种命令。结果在使用navicat远程连接服务器mysql时卡住了,以下就是从卡住到解决的过程,希望能帮助到同样遇到这个问题的人。
问题根源
先说结论,由于是阿里云新实例,控制台未设置规则,远程无法访问3306这个端口,导致了客户端远程连接出现10038这个错误。
排查过程
mysql登录
先确定是否能正常在服务器上登录
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connectionid is 9Server version:8.0.21 MySQL Community Server - GPL
很显然登录成功,能正常操作show databases;这样的命令
mysql>show databases;+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
创建数据库
然后尝试创建数据库