客户端(已经安装MySQL包) 无法远程连接数据库ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.148.102' (113)

[root@192 ~]# mysql -uroot -p123qqq...A -h 192.168.148.102
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.148.102' (113)


测试网络连通性:
[feng@192 ~]$ ping 192.168.148.102
PING 192.168.148.102 (192.168.148.102) 56(84) bytes of data.
64 bytes from 192.168.148.102: icmp_seq=1 ttl=64 time=0.147 ms
64 bytes from 192.168.148.102: icmp_seq=2 ttl=64 time=0.117 ms
64 bytes from 192.168.148.102: icmp_seq=3 ttl=64 time=0.143 ms
^Z
[1]+ 已停止 ping 192.168.148.102

服务端:
登录MySQL,可以登录


关闭防火墙
[feng@192 ~]$ su -
密码:
上一次登录:六 2月 19 18:39:35 CST 2022pts/1 上
[root@192 ~]# systemctl disable firewalld
[root@192 ~]# service firewalld stop
Redirecting to /bin/systemctl stop firewalld.service

 

客户端:
再次远程登录
[root@192 ~]# mysql -uroot -p123qqq...A -h 192.168.148.102
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MySQL [(none)]>

posted @ 2022-02-20 22:00  东山有耳  阅读(89)  评论(0)    收藏  举报