ubuntu16.04为例:
1.修改服务器端绑定地址
mysqld的配置地址为/etc/mysql/mysql.conf.d/mysqld.cnf文件
修改bind_address=127.0.0.1 修改为0.0.0.0
2.赋予用户远程登录的权限
update user set host ='%' where user='root';
grant all on *.* to root@'%' identified by 'root';
flush privileges;
3.重启mysql服务
sudo /etc/init.d/mysql restart