user mysql;//进入mysql库 update user set host ='%' where user='root';//设置root用户的可允许host为%,即所有的host都可以访问(默认的是localhost) ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';//如果root的plugin列中已经为Mysql_native_password了,可以不写 flush privileges;//清空缓存