一直以来,MySQL的应用和学习环境都是MySQL 5.6和之前的版本,也没有去关注新版本MySQL 5.7的变化和新特性.今天帮人处理忘记root密码的时时候,发现以前的方法不奏效了.具体情况如下所示: 案例环境如下: 操作系统 : Red Hat Enterprise Linux Server release 6.6 (Santiago) 数据库版本: 5.7.18 MySQL Community Server (GPL) 忘记密码,输入错误的密码时遇到下面错误信息: [root@mytes…
1.修改配置文件 vim /etc/my.cnf 在[mysqld]节点添加 skip-grant-tables 2.重启mysql 3.用空密码进入 mysql -uroot 执行 update mysql.user set authentication_string=password('123') where user='root' and Host = 'localhost'; flush privileges; 退出mysql 还原my.cnf 补充,使用上面方法修改密码后,在使用mys…