OS:CentOS release 6.9 environment:


before the modification confirmation root password change is the need to restart the MySQL library, confirm the production really can restart the MySQL library;

to confirm the production whether there is a direct use of root users to connect to the use of the library, if there must be a corresponding joint change;

modify please stop the connection to database application before the password is stopped, the base for all production line.


 PS database to modify the password to stop -ef|grep mysql|grep -v grep # to find the corresponding MySQL server daemon, see if there are other MySQL services for PS -ef|grep mysql|grep -v guard grep|xargs kill -9 # kill root promoter library and library command process daemon, otherwise the library will automatically start again # kill the process, parking please ensure that the connection to the database, the application of all the stops before killing processes!!! Mysqld_safe --user=mariadb --skip-grant-tables & # ignore the authorization form if the starting library, use the password to connect to the database login # library application if not stopped, this is unable to successfully connect to the database mysql use MySQL; select Host, User Password, from user where user='root'; exit; # into MySQL library,. The value of the current root query code, save the secret value for # such as my current password rollback is Vincent, is'*CDA83EBFF468E905FF304FE0D3D9F4D665C6579D' MySQL use density MySQL; update user set password= password ('test') where user='root'; exit; # into MySQL library, mysqladmin shutdown mysqld_safe --user=mariadb set the root password & # restart the database, login MySQL -uroot -ptest -Dmysql exit test; # 


, when you modify the root password, you find many problems. For example, there are unknown applications connected to the library with the old root password.

 MySQL -uroot -ptest -Dmysql update user set password='*CDA83EBFF468E905FF304FE0D3D9F4D665C6579D'where user='root'; flush privileges; exit; # use back to record root password before the change of density of MySQL -uroot -pvincent -Dmysql exit rollback; density # rollback completed 

4. knowledge

can directly use the password password, can not directly density reversal method is to find the password in plaintext, secret value view the password you can use the password function:

 MySQL -uroot -pvincent select password ('vincent'), password ('test' 

); but if you know the secret value, you can do not know root permissions to modify a user's password then, using the reduction.
this situation is often used for a user's password forgetting, reset the password, and the same situation appears in the Oracle database.

This concludes the body part