1 -- 登录 2 mysql -u root -p 3 -- 查询mysql用户 4 select user,host,authentication_string from mysql.user; 5 -- 切换到mysql库 6 use mysql; 7 -- 修改root用户host 8 update user set host='%' where user='root'; 9 -- 授权 10 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; 11 -- 刷新 12 FLUSH PRIVILEGES;