MySQL8忘记root密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
shell> service mysqld stop shell> echo "skip-grant-tables" >>/etc/my.cnf shell> service mysqld restart shell> mysql -u root -p //password直接回车 mysql>use mysql; mysql>update user set authentication_string='' where user='root'; mysql>flush privilegs; mysql>exit; shell>vim /etc/my.cnf 删除最后一行skip-grant-tables shell> service mysqld restart shell> mysql -u root -p //password直接回车 mysql>ALTER user 'root'@'localhost' IDENTIFIED BY 'Qwe12#asD' mysql>flush privilegs; |