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