mysql 8.0重置用户密码skip-grant-tables

骑驴找蚂蚁 · 2019-03-08

使用skip-grant-tables 模式


1. UPDATE mysql.user SET authentication_string=null WHERE User='root';
2. FLUSH PRIVILEGES;
3. mysql -u root
4. ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';

非skip-grant-tables 模式


1. ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';

全栈工程师

1.4k 浏览
0