和旧版本设置,有点不一样
mysql -u root mysql> use mysql; # 查看user表信息,注意密码字段已改为autentication_string mysql> select user, host, authentication_string from mysql.user;
# 修改root的host改为%,默认root的host为 localhost mysql> update user set host='%' where user='root'; # 设置密码 mysql>ALTER USER 'root'@'%' IDENTIFIED BY 'mysql123'; #刷新 mysql>FLUSH PRIVILEGES;
最后的查询结果:
标签:Mysql8,密码,host,user,设置,mysql,root,远程 From: https://www.cnblogs.com/Craft001wen/p/17062438.html