- service mysqld stop
- mysqld_safe –skip-grant-tables –user=mysql& // 跳过授权表 mysql.user 和 mysql.db
- mysql -uroot
- set password=password("yourpasswd"); // 出现报错是因为加上了 –skip-grant-tables
- Mysql> update user set password=password("yourpasswd") where user=‘root‘ and host=‘localhost‘;
- Mysql> set password for [email protected]=password("yourpasswd");
- Mysql> set password=password("yourpasswd");
时间: 2024-11-03 20:48:44