MySQL8.0.11 latest version password reset (what should I do if I forget my MySQL password?)

Steps to change password if forgotten:

  1. Stop the MySQL service

     cmd command: net stop mysql

  2. Create a mysql_init.txt file

    Add a sentence: ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678'; The information in the quotation marks is the account number and password

    keep;

  3. Enter the bin directory where MySQL is installed and open the cmd console.

    Execute: mysqld --init-file=f:/mysql_init.txt --console  

    You can view the running results on the console, and the following prompts will show that you can successfully log in with the password 12345678;

  4. Reopen a cmd console

    Log in with the password in TXT and change the password as follows

5. Stop the command running in the first cmd window, then restart mysql and delete the created mysql_init.txt file, and log in with the modified password 123456, as shown in the figure

If you can already log in and use

Guess you like

Origin blog.csdn.net/weirdo_world/article/details/81102305