mysql5.7 开启root远程访问权限,修改密码

登陆进去mysql终端

use mysql;

update user set host = ‘%’ where user = ‘root’; (使mysql root用户可以连接上任意的ip地址)

FLUSH PRIVILEGES;

密码修改也变更了

法一:

mysql> update mysql.user set authentication_string=password(‘123qwe’) where user=’root’ and Host = ‘localhost’;
1
法二:

mysql> alter user ‘root’@’localhost’ identified by ‘123’;
1
法三:

mysql> set password for ‘root’@’localhost’=password(‘123’);
1
记得最后要刷新权限

mysql> flush privileges;

此条目发表在mysql分类目录。将固定链接加入收藏夹。