// article · mysql
MySQL 的 root 忘记密码解决方法
1、停止mysql服务;
systemctl stop mysqld2、进入mysqld目录,用以下命令启动MySQL,以不检查权限的方式启动:
mysqld --skip-grant-tables &3、新建命令行窗口(注意不要在原来窗口),然后用空密码方式使用root用户登录 MySQL
mysql -u root4、修改root用户的密码
mysql> update mysql.user set password=PASSWORD('newpassword') where User='root';
mysql> flush privileges;
mysql> quit