bayaim_mysql_忘记密码 [仅限 5.6以下]

bayaim_mysql_忘记密码 [仅限 5.6以下]

原创 作者:bayaim 时间:2017-12-26 10:47:41 0删除编辑

忘记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
posted @ 2018-08-07 14:46  上帝_BayaiM  阅读(127)  评论(0编辑  收藏  举报