mysql是apt-get安裝的
1.給賬戶連接的權(quán)限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
2.在mysqld.cnf找到bind-address = 127.0.0.1,加個(gè)#號(hào)注釋掉
配置文件路徑 /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
3.重啟服務(wù)器
sudo service mysql restart