Like other databases, MySQL grants different permissions to different users for security considerations. The following describes how to change the password of MySQL for your reference.
The first thing to note is: Generally, you need to have the root permission in MySQL to change the password of mysql. In this way, you cannot change the password of MySQL, unless you ask the Administrator for help.
MySQL password change method:
Method 1
Using phpMyAdmin (a graphical MySql database management tool) is the simplest. You can directly use SQL statements to modify the user table of the mysql database, but do not forget to use the PASSWORD function to Insert the user using the Insert command, modify the user's use of the Update command and Delete the use of the Delete command. This section describes the user field of a data table.
Method 2
Use mysqladmin. Enter mysqladmin-u root-p oldpassword newpasswd to execute this command, you need to enter the original root password, so that the root password will be changed to newpasswd. Similarly, change the root in the command to your username, and you can change your password. Of course, if your mysqladmin cannot connect to mysql server, or you cannot execute mysqladmin, this method is invalid, and mysqladmin cannot clear the password. The following methods are used at the mysql prompt and must have the root permission of mysql.
Method 3
Mysql> insert into mysql. user (Host, User, Password) VALUES (\ '% \', \ 'System \ ', PASSWORD (\ 'manager \'));
Mysql> flush privileges is adding a user with the username system and Password manager. Be sure to use the PASSWORD function, and then use flush privileges for confirmation.
Method 4
The REPLACE statement mysql> replace into mysql. user (Host, User, Password) is used)
VALUES (\ '% \', \ 'System \ ', PASSWORD (\ 'manager \'));
Mysql> FLUSH PRIVILEGES
Method 5
Use the set password statement mysql> set password for system @ \ "% \" = PASSWORD (\ 'manager \ '). You must also use the PASSWORD () function, however, you do not need to use flush privileges for confirmation.
Method 6
Use the GRANT... identified by statement to GRANT permissions. Mysql> grant usage on *. * TO system @ \ "% \" identified by \ 'manager \ '; here, the PASSWORD () function is unnecessary and you do not need TO use flush privileges for confirmation. Note: The PASSWORD () function is used to encrypt passwords and automatically interpret them in MySql.
The above describes how to change the password of MySQL.
Common mysql commands in linux
Nine common mysql commands
Full description of permission fields in the Mysql User table
Common MySQL auto-increment Fields
Mysql character encoding method