gpt4 book ai didi

mysql - 无法远程连接到 MySQL DB

转载 作者:行者123 更新时间:2023-12-04 19:31:05 24 4
gpt4 key购买 nike

我不断尝试使用 POPSQL 连接到我的 MySQL 数据库,并且不断收到错误代码 ECONNREFUSED (Error Connection Refused) M.Y.I.P:3306,我不知道为什么。设置如下:
我在 Cent OS 上运行 Plesk,它使用 MySQL DB (Maria),我通常使用 Plesk 界面使用 PHPMyAdmin 连接到该数据库。
现在我正在尝试使用此 POPSQL 连接到它,但我无法使用任何应用程序进行远程连接。
我的故障排除:
1:重启服务器:多次,每次更改后。
2:检查防火墙:它已启用,正在运行,并且端口 3306 已打开(我也尝试通过 SSH 连接,我可以在终端中进行连接,但不能使用 POPSQL 或任何其他 SQL 连接软件)
3:检查Plesk Config:凭据正确,允许通过任何主机进行远程连接Plesk DB config
4:检查Maria config,绑定(bind)地址是0.0.0.0而不是127.0.0.1

[mysqld]
bind-address = 0.0.0.0
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

我对数据库故障排除的知识到此为止,因此,如果您对正在发生的事情以及如何修复它有任何想法或建议,请告诉我。再说一次,我对这一切都很陌生,所以我确信这只是一个简单的错误,但多加一双眼睛会非常有帮助。

最佳答案

我不擅长防火墙,这表明。
我正在编辑默认的防火墙区域“public”而不是“plesk”,它控制着该服务器的流量。
备查:
1:检查哪些区域处于事件状态。

firewall-cmd --get-active-zones
2:编辑事件区域
firewall-cmd --zone=plesk **OR whatever your zone is called** --add-port=3306/tcp --permanent
2.5:确保它说成功
firewall-cmd --zone=plesk --add-port=3306/tcp --permanent 
success
3:重新加载防火墙
firewall-cmd --reload
感谢 Bernd Bufen 为我指明了正确的方向。
不要忘记基础知识!

关于mysql - 无法远程连接到 MySQL DB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70535796/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com