Tag:change block pos war Password Process exit centos server
Translated from: http://www.cnblogs.com/sbaicl/articles/3132010.html
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 password-protected during the reset of the root password of MySQL
Status, other users can also log in and modify MySQL information arbitrarily. MySQL can be used to
and stop Apache and all user processes to implement the server's quasi-security
State. 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:
# VIM/ETC/MY.CNF
Add a sentence to the paragraph in [mysqld]: Skip-grant-tables
For example:
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
' 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
5. Change MySQL login settings back
# VIM/ETC/MY.CNF
Delete the skip-grant-tables you just added in the paragraph [mysqld]
Save and exit Vim
6. Restart Mysqld
# Service Mysqld Restart
stopping MySQL: [OK]
Starting MySQL: [OK]
"Go" under CentOS MySQL forgot root password solution