mysql 重置root密码

忘记密码重置:

cd /etc

vi my.cnf

在[mysqld] 下新增一行

–skip-grant-tables

重启mysqld, systemctl restart mysqld

 

mysql -h localhost -uroot

mysql>use mysql;

mysql>select plugin from user where user=’root’;

mysql>update user set plugin=’mysql_native_password’;

mysql>update user set authentication_string=password(‘123456′) where user=’root’ and host=’localhost’;

mysql>flush privileges;

将my.cnf中新增的的行,删除

重启mysqld, systemctl restart mysqld

搞定!

发表评论