[root@MySQL-S mysql]# vim /etc/my.cnf
2.在 [mysqld] 这个模块添加以下内容。
skip-grant-tables
3.重启 MySQL。
[root@MySQL-S mysql]# ./support-files/mysql.server restart
4.用空密码进入,回车。
[root@MySQL-S mysql]# mysql
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';
上一篇:MySQL 主从同步。
下一篇:mysql查看被锁住的表