- 停止MySQL服务
service mysqld stop
- 修改配置文件跳过MySQL密码验证
#vim /etc/my.cnf(注:windows下修改的是my.ini)在[mysqld]后面任意一行添加“skip-grant-tables”
- 重启MySQL服务
service mysqld restart
- 登录MySQL
mysql -uroot -p Enter
- 修改root用户密码
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123'; %代表可以远程访问
出现The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement解决方法:刷新mysqlflush privileges
重复第五步即可
Last modification:September 7th, 2020 at 01:31 pm
© 允许规范转载