The first step: output cmd in the run, log in;
Step 2: Stop the mysql service, the command is:
net stop mysql
Note, if not, switch the current directory to the mysql\bin directory for operation;
Step 3: Enter in the cmd command line:
mysqld --defaults-file="D:\mysql\mysql5.6.24\my.ini" --skip-grant-tables
Step 5: Enter mysql mode:
mysql -u root
修改密码:
UPDATE mysql.user SET Password=PASSWORD("newpassword") WHERE User = 'root' and Host='localhost';
Load the privilege table to make the new password take effect:
FLUSH PRIVILEGES;