mysql是apt-get安装的
1.给账户连接的权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
2.在mysqld.cnf找到bind-address = 127.0.0.1,加个#号注释掉
配置文件路径 /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
3.重启服务器
sudo service mysql restart