• IPtables 配置3306端口但是却无法连接数据库


    一. 设置远程用户访问权限 数据库中添加
    grant all privileges on *.* to 'root' @'%' identified by 'password'

    其中%代替IP 表示开启所有IP访问 password代表远端访问需要输入的密码 例如:PYTHON@sun2020 
    flush  privileges;

    quit

    systemctl restart mysqld 

    二. 开通3306端口
    方法一
     vim /etc/sysconfig/iptables

    添加如下规则:
    -A INPUT -p tcp  --dport  3306 -j ACCEPT 
    (注意:添加位置一定要在-A INPUT -j REJECT --reject-with icmp-host-prohibited
    之前)

    最后重启iptables 

    systemctl restart iptables

    方法二
    在命令行中输入如下命令:
    iptables -A INPUT -p tcp  --dport  3306 -j ACCEPT
    service  iptables  save
    systemctl  restart  iptables

  • 相关阅读:
    SpringAOP-基于@AspectJ的简单入门
    SpringAOP-切面优先级
    Commons_IO_FileUtils的使用
    java_IO_装饰器
    java_IO_3
    java_IO_2
    java_IO_1
    App Inventor
    java学习_5_24
    java学习_5_23
  • 原文地址:https://www.cnblogs.com/kyooo/p/13230944.html
Copyright © 2020-2023  润新知