1. First verify that the server is in a secure state, that is, no one can connect to the MySQL database arbitrarily. Because the MySQL database is completely out of password-protected state during the reset of the root password of MySQL, other users can log in and modify the MySQL information arbitrarily. It is possible to implement the server's quasi-security state by enclosing MySQL's external ports and stopping Apache and all user processes. The safest state is to operate on the console of the server and unplug the network cable. 2. To modify the login settings for MySQL: # vi/etc/my.cnf in [MYSQLD] paragraph: skip-grant-tables For example: [Mysqld] Datadir=/var/lib/mysql socket=/var/lib/ Mysql/mysql.sock Skip-grant-tables Save and Exit VI. 3. Restart Mysqld #/etc/init.d/mysqld restart stopping mysql: [OK] starting MySQL: [OK] 4. 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 5. Change the login settings for MySQL back to # vi/etc/my.cnf add the skip-grant-tables that you just added in the [mysqld] section to save and Exit VI. 6. Restart Mysqld #/etc/init.d/mysqld restart stopping mysql: [OK] starting MySQL: [OK]work for fun,live for love!
Linux under the root password of MySQL forgot to solve the party