Author: Wang Meng (HeartIcy@163.com)
Losing your password is a very sad thing, especially losing the root password :(. Pretend it yourself
If you lose it for fun, you will lose it, but what if it is If the production server is down, it will be very troublesome!
Now let’s assume that the root password is lost due to the intrusion. Here I will talk about my own
views on such a problem.
I encountered this problem first. We don’t need to panic, the whole recovery process is very simple.
1 Download the MySQL source code distribution package. There is no need to distinguish the operating system. The things we need are the same
2. Rename your own mysql. The mysql folder under the data directory is oldmysql.
3 Copy the mysql directory under the data directory in the source code package to your mysql data directory
4 Restart mysql, now the authorization relationship of mysql. Just like a new installation, log in with an empty password
and then adjust the authorization yourself.
5 Open the oldmysql library to check what the problem is.
6 If there is a backup, check the integrity of the original database in the system. Detect to avoid being
modified.
You can completely restore your control over mysql through the above 6 steps. The key point is to check the permissions that the other party has changed and the integrity of the data in the last two steps. Sex test.