1. Modify the MySQL login settings: # VI/ETC/MY.CNF
Add one sentence to the paragraph in [mysqld]: Skip-grant-tables For example: [Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock Skip-grant-tables Save and Exit VI.
2. New Start mysqld
#/etc/init.d/mysqld Restart stopping mysql: [OK] starting MySQL: [OK]
3. Log in and modify the root password of MySQL
#/usr/bin/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;
Reading table information for completion of table and column names you can turn off this feature to get a quicker startup With-a 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 Bye
4. Change MySQL login settings back
# VI/ETC/MY.CNF
Delete the skip-grant-tables that you just added in the [Mysqld] section and Exit VI.
5. Restart Mysqld
#/etc/init.d/mysqld Restart
MySQL root password reset under Linux, not applicable to integrated installation package