From the command line, you can modify the password format of the MySQL database as follows:
Mysqladmin-u username-p Old password password new password
1, add a password to root ab12. First enter directory Mysql\bin under DOS, and then type the following command
Mysqladmin-u Root-password AB12
Note: Because Root does not have a password at the beginning, the-p old password can be omitted.
2, then change the root password to djg345.
Mysqladmin-u root-p ab12 Password djg345
(Note: Unlike the above, the following is because it is a command in a MySQL environment, so it is followed by a semicolon as a command terminator)
3, the command line to modify the root password:
mysql> UPDATE mysql.user SET password=password (' New password ') WHERE user= ' root ';
mysql> FLUSH privileges;
4. Display the current User:
Mysql> SELECT USER ();
To modify a database password using the MySQL command line