admin 管理员组

文章数量: 1087652

MYSQL修改数据库密码

1、mysql5.7以前的版本

选择mysql这个数据库里的user表的password这个字段,修改密码只需依次执行以下sql

update MySQL.user set password=password('123456') where user='root' ;
flush privileges;

2、mysql5.7及更高版本

可是到了5.7版本,user表里就没有了password这个字段了,要想修改密码则需要用authentication_string这个字段,需要依次执行下面sql

update MySQL.user set authentication_string=password('123456') where user='root';flush privileges;

本文标签: MYSQL修改数据库密码