远程登陆ubuntu18.04上的mysql

  1. 修改mysql配置
    1
    2
    3
    4
    5
    6
    7
     vi /etc/mysql/mysql.conf.d/mysqld.cnf
    
     # 将 bind-address            = 127.0.0.1
     # 改为 bind-address            = 0.0.0.0
    
    
     sudo systemctl restart mysql
    
  2. 开放 3306 端口

    1
    2
     # Open port 3306 from Ubuntu Firewall
     sudo ufw allow 3306/tcp