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