mysql 8.0.11 以上版本修改root密碼

xiaobaiha發表於2019-02-28

8.0.11 以上版本移除了password方法

1.if you in skip-grant-tables mode
in mysqld_safe:

UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;
exit;複製程式碼

and then, in terminal:

mysql -u root複製程式碼

in mysql:

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';複製程式碼

2.not in skip-grant-tables mode
just in mysql:

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';複製程式碼


相關文章