First, modify the configuration file mode
1. Turn off MySQL
Linux:
1) Service mysqld stop
2)/usr/local/mysql/support-files/mysql.server Stop
Windows:
1) Execute net stop MySQL at the command prompt
2) Computer Right-click Management Services, find the MySQL service, stop this service
2. Modify the configuration file
Linux configuration file is my.cnf, under Windows configuration file is My.ini, under [mysqld] Add
Skip-grant
3. Restart MySQL
Linux:
1) Service mysqld start
2)/usr/local/mysql/support-files/mysql.server Start
Windows:
1) Execute net start MySQL at the command prompt
2) Computer Right-click Management Services, find MySQL service, start this service
4. Enter MySQL
Linux:
/usr/local/mysql/bin/mysql-u root-p into MySQL
Windows:
D:/mysql/mysql-u root-p into MySQL, where D:/mysql is the MySQL installation directory
5. Change your password
Execute the following statement
Use MySQL;
UPDATE user SET Password=password ("XXX") WHERE user= "root"; where xxx is the password you want to set
Flush privileges;
Exit
6, remove the skip-grant in the configuration file
7. Restart MySQL
Ii. Command mode (for Linux)
1. Turn off MySQL
1) Service mysqld stop
2)/usr/local/mysql/support-files/mysql.server Stop
2. Execute the following command
/usr/local/mysql/bin/mysqld_safe--skip-grant
3. Enter MySQL
/usr/local/mysql/bin/mysql-u root-p into MySQL
4. Change your password
Execute the following statement
Use MySQL;
UPDATE user SET Password=password ("XXX") WHERE user= "root"; where xxx is the password you want to set
Flush privileges;
Exit
5. Restart MySQL
PHPmyadmin 2.11.3+2.11.4 Universal password localhost ' @ ' @ ' only need to enter the account password do not need to enter
Reset operation after MySQL forgot password