跳转到帖子
在APP中访问

A better way to browse. Learn more.

乾坤堂社区

主屏幕上的APP,包含推送通知、徽章等。

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • 网站管理

错误信息 1130 - 不允许主机 '192.168.X.X' 连接到此 MariaDB 服务器 表示你的 MariaDB 服务器配置不允许来自 IP 地址 192.168.1.11 的连接。
这通常是因为 MariaDB 的访问控制规则或者防火墙设置限制了外部 IP 的访问或者权限问题。解决的步骤如下:

1. 确认 MariaDB 配置文件中的绑定地址

MariaDB 默认配置为只允许本地连接(即 127.0.0.1localhost),如果你希望从其他主机(例如 192.168.1.11)连接,必须调整 my.cnf 配置文件。

  1. 打开 MariaDB 配置文件,通常位于 /etc/mysql/my.cnf/etc/my.cnf
sudo nano /etc/mysql/my.cnf
  1. 找到 bind-address 配置项,它可能是这样的:
bind-address = 127.0.0.1

这表示只允许本机连接。如果你希望允许任何 IP 连接,可以将其更改为:

bind-address = 0.0.0.0

或者,如果你只希望允许来自特定 IP 地址的连接,可以设置为:

bind-address = 192.168.1.11
  1. 保存并关闭文件后,重新启动 MariaDB 服务:
sudo systemctl restart mariadb

2. 检查 MariaDB 用户的权限

如果你已经修改了 bind-address,但仍然无法连接,可能是由于 MariaDB 中的用户权限设置不允许来自 192.168.1.11 的连接。你需要确保为用户配置正确的权限。

  1. 登录到 MariaDB 数据库:
sudo mysql -u root -p
  1. 确认你的 MariaDB 用户具有从特定 IP 地址连接的权限。例如,如果你要允许用户 username 从 IP 192.168.1.11 连接,请执行以下 SQL 命令:
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'192.168.1.11' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
  • database_name 替换为你希望该用户访问的数据库名称。
  • username 替换为用户名。
  • password 替换为密码。如果你希望允许该用户从任何 IP 地址连接,可以使用 % 通配符:
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
  1. 退出 MariaDB:
EXIT;

3. 检查防火墙设置

如果你已经配置了 MariaDB 允许外部连接,但仍然遇到问题,可能是防火墙阻止了对 MariaDB 端口(通常是 3306)的访问。你需要确保防火墙允许来自 192.168.1.11 的访问。

对于 ufw 防火墙(Ubuntu/Debian):

  1. 允许 MariaDB 端口(3306):
sudo ufw allow from 192.168.1.11 to any port 3306
  1. 如果你希望允许任意 IP 地址连接:
sudo ufw allow 3306
  1. 重载防火墙:
sudo ufw reload

对于 firewalld 防火墙(CentOS/RHEL):

  1. 允许 MariaDB 端口(3306):
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
  1. 重载防火墙:
sudo firewall-cmd --reload

4. 检查 SELinux 配置(如果适用)

在一些基于 CentOS 或 RHEL 的系统上,SELinux 可能会限制外部连接。你可以检查 SELinux 是否阻止了 MariaDB 的外部连接。

  1. 检查 SELinux 的状态:
getenforce
  1. 如果返回值为 Enforcing,可以临时设置为宽松模式来测试连接:
sudo setenforce 0

如果连接成功,可以通过配置 SELinux 策略来允许 MariaDB 外部连接。

  1. 永久修改 SELinux 配置:编辑 /etc/selinux/config 文件,将 SELINUX=enforcing 改为 SELINUX=permissive,然后重启系统。

5. 确认 MariaDB 服务正在运行

确保 MariaDB 服务正常运行并且没有被防火墙或其他配置阻止。

sudo systemctl status mariadb

如果服务没有运行,可以使用以下命令启动它:

sudo systemctl start mariadb

总结:

  1. 修改 my.cnf 配置文件,允许 MariaDB 绑定到外部 IP 地址。
  2. 授予正确的用户权限,允许从 192.168.1.11 连接。
  3. 检查防火墙设置,确保 3306 端口开放。
  4. 检查 SELinux 设置,确保没有阻止 MariaDB 外部连接。

按照上述步骤操作后,应该可以解决 1130 - 不允许主机 '192.168.1.11' 连接到此 MariaDB 服务器 的问题。如果问题依然存在,可以检查日志文件来获取更多错误信息。

成长就是不断打破并重建三观

  • 查看数 79
  • 已创建
  • 最后回复

创建帐户或登录后发表意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.