zoukankan      html  css  js  c++  java
  • mysql远程访问

    增加可远程访问的mysql账户

    • 登陆mysql客户端

      mysql -uroot -p[密码]
      
    • 创建可远程的MySQL账号

      grant 权限列表 on 数据库 to '用户名'@'%' identified by '密码';
      

      注意是:‘用户名’@’%’,其中“%”表示此账户可以使用任何ip的主机登录访问此数据库

    • 修改配置文件

      sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
      
    • 查找到"bind-address = 127.0.0.1"并将该句注释

    # localhost which is more compatible and is not less secure.
    bind-address = 127.0.0.1
    

    注释后为

    # localhost which is more compatible and is not less secure.
    # bind-address = 127.0.0.1
    
    • 重启MySQL服务
      sudo service mysql restart
      
    • 测试是否可以连接
      telnet [ip] [3306]
      

    参考文献

    Can’t Connect to MySQL Server Remotely on Ubuntu | DevAnswers.co

  • 相关阅读:
    ZOJ 3556
    ZOJ 2836
    HDU 2841
    HDU 4135
    POJ 3695
    POJ 2773
    HDU 4407
    HDU 1796
    ZOJ 3688
    ZOJ 3687
  • 原文地址:https://www.cnblogs.com/bitbitbyte/p/12536598.html
Copyright © 2011-2022 走看看