linux下的mysql5.7忘记密码mysql
[root@iz09a32x1sghz3z ~]# vi /etc/my.cnf
[root@iz09a32x1sghz3z ~]# service mysqld restart
用root帐号登陆: [root@iz09a32x1sghz3z ~]# mysql -u rootlinux
使用mysql中的mysql数据库: mysql> use mysql;sql
修改密码: update user set authentication_string = password("Szfore_68638") where user="root" ;数据库
刷新数据库: flush privileges;ui
退出: quit;spa
注意:mysql5.7的user表中的password字段已经改为了authentication_string 字段了。rest
这时候,须要输入的命令是update user set authentication_string = password("Szfore_68638") where user="root" ;code
[root@iz09a32x1sghz3z ~]# service mysqld restart