数据库远程连接报错ERROR 2003 (HY000): Can't connect to MySQL server on '10.102.169.77' (111)


1.报错如下:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘10.102.169.77’ (111)
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘10.0.0.163’ (111 “Connection refused”)

2.telnet也无法访问。检查3306端口也一直在打开。
3.检查后发现数据库监听在本地127.0.0.1所以无法访问。修改配置文件后让监听所有主机。
~ vim /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 127.0.0.1 # 修改为0.0.0.0
4.重启数据库
~ systemctl restart mariadb
5.测试访问。
~ mysql -h 10.102.169.xx -P3306 -uhaitang -pxxxx
Welcome to the MariaDB monitor. Commands end with ; or /g.
Your MariaDB connection id is 31
Server version: 10.1.48-MariaDB-0ubuntu0.18.03.1 Ubuntu 18.04

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

Type ‘help;’ or ‘/h’ for help. Type ‘/c’ to clear the current input statement.

MariaDB [(none)]>

原创文章,作者:745907710,如若转载,请注明出处:https://blog.ytso.com/275959.html

(0)
上一篇 2022年7月22日
下一篇 2022年7月22日

相关推荐

发表回复

登录后才能评论