【MySQL】更改用户授权访问
数据库连接 mysql -uroot -p 查询当前用户host设置 select user,host from mysql.user; 创建新用户,密码及host CREATE USER 'root'@'192.168.1.1' IDENTIFIED WITH mysql_native_password BY '你的密码'; 给用户付权限 GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.1' WITH GRANT OPTION; 将之前的host改为localhost update mysql.user set host = 'localhost' where user = 'root' and host = '%'; 检查设置 select user,host from mysql.user; 刷新权限 FLUSH PRIVILEGES;