美文网首页工具癖
配置 MySQL 远程连接

配置 MySQL 远程连接

作者: luozijian | 来源:发表于2017-05-31 00:42 被阅读0次

配置

打开 iptables 3306端口

  • 如果你是 CentOS 系列

    iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
    service iptables save #保存iptables规则
    
  • 如果你是 Ubuntu/Debian 系列

    iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
    iptables-save > /etc/iptables.up.rules #保存iptables规则
    

创建用户

  1. 登录你的远程服务器

    ssh root@your domain.com
    
  2. 登录 MySQL

    mysql -u root -p
    
  3. 创建用户(用户名不能是root)

    create user 用户名 identified by '密码';
    

授权用户

  • MySQL 5.7

    grant all on 数据库名.* to 用户名
    
  • MySQL 5.6

    grant all privileges on 数据库名.* to 用户名@’%’ identified by ‘用户密码’; 
    

如果出现

ERROR 1524 (HY000): Plugin '*9E53930467B20A15727780FB02007B379CE21A84' is not loaded

尝试删除用户在重复以上步骤

相关文章

网友评论

    本文标题:配置 MySQL 远程连接

    本文链接:https://www.haomeiwen.com/subject/suddfxtx.html