Solution to Linux VPS host forgetting MYSQL database ROOT password

888u

Last update at :2024-07-07,Edit by888u

For various reasons, it is possible that the MYSQL password we memorize in our heads or the MYSQL database password saved locally may be lost. Problems are not terrible, as long as we find a suitable method to solve the problem. In the morning, a netizen used LLsMP one-click package VPS website building environment. He could not find the ROOT password for the MYSQL database and could not manage the PHPMYADMIN database. Now Snail has some time to sort out the solution so that if he encounters similar problems in the future Friends can solve it directly.

First, modify the MYSQL login settings

vi /etc/my.cnf

Edit the my.cnf file and add the skip-grant-tables line in [mysqld].

Add as shown in the picture, then:wq save and exit.

Second, restart MYSQLD

/etc/init.d/mysqld restart

Third, prepare to change the MYSQL password

[[email protected] ~]# /usr/bin/mysqlWelcome to the MySQL monitor. Commands end with ; or \\\\g.Your MySQL connection id is 2Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type \\’help;\\’ or \\’\\\\h\\’ for help. Type \\’\\\\c\\’ to clear the current input statement.

mysql> USE mysql ;Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changedmysql> UPDATE user SET Password = password ( \\'laozuo.org\\' ) WHERE User = \\'root\\' ;Query OK, 3 rows affected (0.00 sec)Rows matched: 3 Changed: 3 Warnings: 0

mysql> flush privileges ;Query OK, 0 rows affected (0.00 sec)

mysql> quitBye

The red part is what we need to enter. Set the password to laozuo.org. We can define a new password ourselves or modify it later.

Fourth, edit the /etc/my.cnf file

Delete the skip-grant-tables line added at the beginning, then save and exit.

Finally, restart MYSQLD

/etc/init.d/mysqld restart

After restarting MYSQLD, we can log in to MYSQL management through PHPMYADMIN and log in with the reset new password.

Recommended site searches: godaddy space, how to query ip address, mainland China ip agent mobile ip agent, which high-defense game server is the best, free domain name space application for free stable space, free ASP space for renting a server, no registration required in mainland China Server,

Solution to Linux VPS host forgetting MYSQL database ROOT password

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码