• LNMP环境下 远程连接mysql数据库


    一、为了安全起见,lnmp环境是禁止远程连接的,他会删除iptables里面的3306端口的防火墙规则


    一、如果是phpmydmin  那要把权限里要远程连接的用户主机改成 * 
    参考:
    https://bbs.vpser.net/thread-3135-1-1.html

    或者
    mysql -uroot -p  输入密码

    use mysql;
    update user set host = '%' where user='root';

    flush privileges;

    exit

    root 可以换成我们的用户名

    如果没有创建用户,执行
    grant  all privileges on 数据库名.* to 用户名@'%' identified by '密码';

    如:grant all privileges on mysql.* to 'root'@'%' identified by '123456';

    将所有iptables 以序号标记显示,执行:
    iptables  -L -n --line-numbers

    添加3306端口号到防火墙

    iptables -I INPUT -p tcp --dport 3306 -j ACCEPT 
    service iptables save

    service iptables restart

    service mysql restart

    然后用mysqlyog连接数据库试试,可以先用mysqlyog右下角的测试连接测试


    二、为了安全起见,lnmp环境是禁止远程连接的,他会删除iptables里面的3306端口的防火墙规则

    iptables里面删除drop 3306端口

    参考iptables教程
    htttps://www.vpser.net/security/linux-iptables.html

    要删除已添加的iptables规则
    将所有iptables 以序号标记显示,执行:
    iptables  -L -n --line-numbers

    比如要删除INPUT里面序号为8 的规则 执行:
    iptables -D INPUT 8

  • 相关阅读:
    师弟大喜之日,送上一幅对联 求横批
    漫画:Google 走了
    产品研发流程改进
    Outlook2010 Bug 一则
    Android 手机用户版本比例
    CDMA 短信中心号码
    UIM卡 PIN 码特点
    [Accessibility] Missing contentDescription attribute on image
    java打印函数的调用堆栈
    android中解析Json
  • 原文地址:https://www.cnblogs.com/cjymuyang/p/11283344.html
Copyright © 2020-2023  润新知