[root@MySQL-S MysqL]# vim /etc/my.cnf
skip-grant-tables
3.重启 MysqL。
[root@MysqL-S MysqL]# ./support-files/MysqL.server restart
4.用空密码进入,回车。
- 执行语句。
MysqL> alter user 'root'@'localhost' identified by '123456';
6.刷新:
MysqL> flush privileges;
或:
update MysqL.user set authentication_string=password('123456') where user='root' and Host = 'localhost';