1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| # 1. 停止mysql # net stop mysql; # brew stop mysql; # systemctl stop mysql.service;
# 2. 无密码登陆 mysqld --console --skip-grant-tables --shared-memory
# 3. 清空密码 UPDATE mysql.user SET authentication_string='' WHERE user='root' and host='localhost';
# 4. 修改密码 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码'; # #
# 5. 试试是否修改成功 mysql -u root -p
|