1、MySQL更改爲只能本地登錄
# use mysql;
# select user,host,Password from user where user='root';
# delete from user where user='root' and host='%';
2、MySQL授予外網登陸權限
grant all privileges on *.* to 授予外網登陸的用戶名@'%' identified by '密碼' WITH GRANT OPTION;
# grant all privileges on *.* to root@'%' identified by 'root' WITH GRANT OPTION;
# flush privileges;