What should I do if I forget the root password in Linux ?, Linux forgot root Password
1. First confirm that the server is in a secure state, that is, no one can connect to the MySQL database at will.
Because, during the resetting of the MySQL root Password, the MySQL database is completely out of password-free
Other users can log on to and modify MySQL information as needed. You can use
The external port is closed, and Apache and all user processes are stopped to implement server quasi-security.
Status. The safest status is to operate on the server Console and unplug the network cable.
2. Modify MySQL Logon Settings:
# Vim/etc/my. cnf
In the [mysqld] section, add skip-grant-tables.
For example:
[Mysqld]
Datadir =/var/lib/mysql
Socket =/var/lib/mysql. sock
Skip-grant-tables
Save and exit vi.
3. Restart mysqld
# Service mysqld restart
Stopping MySQL: [OK]
Starting MySQL: [OK]
4. log on to and modify the MySQL root Password
# Mysql
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 3 to server version: 3.23.56
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql> USE mysql;
Database changed
Mysql> UPDATE user SET Password = password ('new-password') WHERE User = 'root ';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
Mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
Mysql> quit
5. Modify the MySQL Logon Settings.
# Vim/etc/my. cnf
Delete the skip-grant-tables added to the [mysqld] section.
Save and exit vim
6. Restart mysqld
# Service mysqld restart
Stopping MySQL: [OK]
Starting MySQL: [OK]
What should I do if I forget the linux User Password and root password?
Linux root has the highest power. Once the root password is forgotten or stolen, it is a headache. How can I retrieve the root password? I will summarize it as follows:
(1) Linux system password cracking
1. Press e in the grub option menu to enter the editing mode.
2. (Press e) to edit the kernel line to add/init 1 (or/single)
3. Press B to restart
4. Run the following command
# Vi/etc/passwd enter the passwd file
Delete x from the first line of root: X: 0..., change it to root: 0..., save and exit!
The root password is blank when you enter the system.
Change Password
# Passwd root
What should I do if I forget the root login password for linux?
The system password or user name is always incorrect. How to reset it. The root password is lost in Linux mode. Press the [Enter] key to make the editing result take effect. You will be taken to edit the mode screen, from