1) 开放绑定地址
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0
2) 允许root用户外网访问
mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
UPDATE mysql.user SET host='%' WHERE user='root';
3) 更改授权方式
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '新密码';
来源:oschina
链接:https://my.oschina.net/maomaoispan/blog/4940499