This article introduces how to modify the root password in linux and windows. if you encounter such problems, you can refer to this article to modify your password.
This article introduces how to modify the root password in linux and windows. if you encounter such problems, you can refer to this article to modify your password.
If you forget the root password locally, try the following methods:
Start CMD and stop the service first.
Net stop mysql
Go to the bin folder under the mysql installation directory and enter
Mysqld-nt -- skip-grant-tables
Skip password detection
Then a new cmd window is opened.
Enter mysql and press enter to enter mysql as the root user.
Use mysql
Update user set password = password ("new password") where user = "root ";
Flush privileges;
If no error message is displayed, the password can be changed successfully.
Linux solution
This section describes how to use grub in all linux versions:
1. on the Grub boot loader menu, select the entry you want to enter and 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 to enter edit mode;
3. add "init =/bin/bash" at the end of the sentence and press enter;
4. press "B" to start the system.
In this way, we can get a bash shell. after entering the shell, the Mount mode of the root partition is read-only by default. we need to change it to writable; otherwise, the root password cannot be changed:
Mount-no remount, rw/
Passwd root
Sync
Mount-no remount, ro/
Reboot
In this way, the password of the root user of debian can be changed successfully.