方法一:使用命令行 win+R cmd打开命令行窗口
C:\Users\DELL>mysql -u root -p
Enter password: ****
C:\Users\DELL>mysql> select host from user where user='root';
C:\Users\DELL>mysql> update user set host='%' where user='root'
C:\Users\DELL>mysql> flush privileges
方法二:Navicat连接本地数据库,找到库中的user表,修改host为%,表示授权给所有的用户