in linux mysql user root password forgotten solution

/Etc/my.cnf 1.vim
[mysqld]
Skip-Grant-Related Tables ## additional rows to skip the permissions table,

2. Restart MySQL
systemctl restart mysqld

3.mysql 登陆mysql
mysql> use mysql;
mysql> UPDATE user SET Password = password ( 'zha123456' ) WHERE User = 'root' ;
mysql> flush privileges ;
mysql> quit

4. Recovery profile the my.cnf
Vim /etc/my.cnf
[mysqld]
Skip-Grant-Tables ## to remove this line, continue to validate authority table,

5. Restart MySQL
systemctl the restart mysqld

Guess you like

Origin www.cnblogs.com/zhaoguiyuan/p/11116155.html