数据库远程连接报错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端口也一直在打开。
检查后发现数据库监听在本地127.0.0.1所以无法访问。修改配置文件后让监听所有主机。

# vim /etc/mysql/mariadb.conf.d/50-server.cnf 
bind-address            = 127.0.0.1    # 修改为0.0.0.0

3.重启数据库

# systemctl restart mariadb

4.测试访问。

# 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)]> 
posted @   梨花海棠  阅读(1136)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
点击右上角即可分享
微信分享提示
主题色彩