Centos7中MySQL忘记密码处理方法
1、更改/etc/my.cnf文件
vi /etc/my.cnf,在[mysqld]中添加
skip-grant-tables
2、重启MySQL服务
service mysqld restart
3、使用用户无密码登录
mysql -uroot -p (直接点击回车,密码为空)
4、选择数据库
use mysql;
5、修改密码
update user set authentication_string=password(‘123456’) where user=‘root’;
6、刷新权限
flush privileges;
7、退出
exit