日常问题--开启阿里云mysql远程登录

  1. 关闭防火墙firewall

     systemctl stop firewalld.service
     systemctl disable firewalld.service
     systemctl mask firewalld.service
    
  2. 安装iptables

     yum install iptables-services -y
    
  3. 启动设置防火墙

     systemctl enable iptables
     systemctl start iptables
    
  4. 使用iptables开启3306端口

     iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
     service iptabels save
     service iptables restart
    
  5. 开启mysql远程授权

     GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.100' IDENTIFIED BY 'ABC123' WITH GRANT OPTION;
     flush privileges;
    
  6. window开启telnet检查是否能连通3306端口
    window/启用或关闭Windows功能/telnet客户端
    telnet 47.9.27.92 3306

  7. 发现无法连通3306端口,查原因发现是没有在阿里云控制台添加入口端口规则
    阿里云控制台/云ecs/网站和安全/安全组/安全组规则/添加规则(加入3306端口)

你可能感兴趣的:(日常问题--开启阿里云mysql远程登录)