What should I do if mySQL lost the root password?
Author: Wang Meng (HeartIcy@163.com)
It is very painful thing, especially the root password is lost: (. If you lose it yourself, you will lose, but in case the production server hangs, you can be big!
It is now assumed to be lost due to the ROOT password caused by the invaded. Here I am talking about my own opinion on such a problem.
First encounter this problem, we don't have to panic, the entire recovery process is also very simple.
1 Download the mysql source code package, do not distinguish the operating system, what we need is the same. 2 Rename the MySQL folder under your MySQL Data directory is OldMysql. 3 Copy the mysql directory under the Data directory in the source package to your MySQL's Data directory. 4 Restart MySQL, now the mysql authorization relationship is the same as a new installation, the empty password logs in and then adjusts the authorization itself. 5 Open Oldmysql This library checks what is wrong. 6 If there is a backup to completely detect the original database in the system, so as not to be modified.
Through the above six steps, you can fully restore your control of MySQL, the focus is the last two steps to check the other party to change those permissions, as well as data integrity detection.