If you have forgotten the root password locally, try the following methods:
Open cmd first stop MySQL service
net stop MySQL
Enter the Bin folder in the MySQL installation directory and enter
Mysqld-nt--skip-grant-tables
Skip Password detection
Then another new CMD window opens
Enter MySQL direct return can enter MySQL with root privileges
Use MySQL
Update user set Password=password ("New password") where user= "root";
Flush privileges;
If no error is prompted, the password can be changed successfully.
How Linux is handled
Describes a method that can be used on all versions of Linux on grub:
1, on the Grub Boot loader menu, select the entry you want to enter, type "E" to enter the editing mode;
2, in the second line (similar to kernel/vmlinuz-2.6.15 ro root=/dev/hda2), type "E" into the editing mode;
3, at the end of the sentence plus "Init=/bin/bash", enter;
4, press "B" to start the system.
So we can get a bash shell, after entering the shell, the mount mode of the root partition is read-only by default, we have to change it to writable, otherwise the root password cannot be changed:
Mount-no REMOUNT,RW/
passwd Root
Sync
Mount-no Remount,ro/
Reboot
This will successfully change the password of the Debian root user