mysql修改密码(命令行)

mysql8:

  alter user 'root'@'localhost' identified by '123456';

mysql5.7:

  update user set authentication_string = password('123456') where user = 'root' and Host = 'localhost';

  flush privileges;

  如果flush 无效,就加上下面这句:

  grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option;

posted @ 2021-02-20 11:33  大力的成长  阅读(37)  评论(0)    收藏  举报