Referenced from: http://blog.sina.com.cn/s/blog_682c287b0100ofz8.html
This is the approach under Linux Server
Method One:
1. Turn off MySQL # service mysqld stop2. Mask Permissions # Mysqld_safe--skip-grant-table screen appears: Starting demo from ..... 3. Newly opened a terminal input # mysql-u root mysql mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root '; Mysql> FLUSH privileges;//Remember to say this, otherwise if you close the previous terminal, the original error will appear mysql> \q method Two: 1. Turn off MySQL # service mysqld stop2. Masking Permissions # my Sqld_safe--skip-grant-table screen appears: Starting demo from ..... 3. Newly opened a terminal input # mysql-u root MySQL mysql> delete from user where user= '; Mysql> FLUSH privileges;//Remember to say this, otherwise if you close the previous terminal, the original error will appear mysql> \q
MySQL account is invalid and the previous password cannot be logged in