bayaim_mysql_忘记密码 [仅限 5.6以下]
忘记root密码
----------------------------------------------------------------
1. 首先关闭mysql,然后使用不验证权限的方式启动:
mysql> mysqld_safe --skip-grant-tables &
2. 直接shell中输入:mysql,进入后对root授权:
mysql> update mysql.user set password=PASSWORD('root') where User='root';
mysql> flush privileges;
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root';
mysql> alter user 'root'@'localhost' identified by '123456';
mysql> update user set password=password("123456") where user="root";
mysql>update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';
mysql>flush privileg
【欢迎关注公众号】:database运维