First, in the case of a known ROOT user password for the MYSQL database , the method for changing the password:
1, shell environment, using mysqladmin command settings: mysqladmin u root p password " enter old password after return
2, MYSQL> environment , use command, directly update mysql library user
U pdate Mysql.user Set Password=password (' new password ') where user= ' Root ' ;
Flush privileges;
Note: TheMySQL statement ends with a semicolon ";"
3. in the mysql> Environment, use the grant command to modify the root user's authorization permissions.
' localhost identified by " New password " ;
Second, If you forgot the password of the ROOT user of the MySQL database , how do you do it? Here's how:
1. Close the currently running mysqld Service Program:servicemysqld stop(to first mysqld Add as System service)
2. Use the mysqld_saft script to start the MYSQLD service in Safe mode (without loading the authorization table)
/usr/local/mysql/bin/mysqld_saft--skip-grant-table &
3. Log in to the database with a root user with a blank password and reset the root user's password
mysql -u root
M ysql> pdate mysql.user set password=password ( ' new password ' where user= root
M ysql> flush Privileges;
This article from "Xu Willow Blog" blog, declined reproduced!
MySQL Root password modification