Centos6.7或Centos6.9下更新mysql5.7密码 解决方案

本人环境为Centos6.9 + mysql5.7

1,VIM编辑mysql5.7配置文件my.cnf

vim /www/lanmps/mysql5.7.17/my.cnf



 
 
找到[mysqld],在下面添加一行 skip-grant-tables


2. 重启Mysql5.7  

/www/lanmps/bin/mysql restart


3. root用户登录mysql5.7,提示密码直接回车,默认密码为空(如上截图)

4,修改root默认密码,并刷新权限

mysql> update mysql.user set authentication_string=password('666666') where user='root' and host='localhost';  
#修改后密码为666666

flush privileges;   #如下截图


5,再次重启mysql5.7

www/lanmps/bin/mysql restart

6,测试新密码登录,或者在phpmyadmin里直接登录root和新密码666666测试 如下截图测试登录成功



猜你喜欢

转载自blog.csdn.net/qq_33468857/article/details/73863293