First, avoid close Login Mysql service
1. Run cmd as an administrator to see if mysql has been launched, if already started, stop: net stop mysql
.
net stop mysql
2. Switch to the MySQL installation path: D:\environment\mysql-5.7.25-winx64\bin
; if already equipped with environment variables, can not switched. At the command line, type:mysqld -nt --skip-grant-tables
mysqld -nt --skip-grant-tables
3. Administrator RestartA cmd command window, type: mysql -uroot -p
, do not lose your password to enter directly into the database.
mysql -uroot -p
Second, retrieve password
If you do not want to change your password, just want to see the original password, you can execute the statement from the command lineselect host,user,authentication_string from mysql.user;
select host,user,authentication_string from mysql.user;
Third, change passwords
In turn execute the following statement at the command line
use mysql
update user set authentication_string=password("123456") where user="root";// 'new_pass' 这里改为你要设置的密码
flush privileges;
quit
Restart MYSQL, enter the password you can!
__________________prefect