Through the MySQL command line, you can modify the password of the MySQL database. The following is a detailed introduction to the MySQL command line. If you are interested, you may wish to take a look.
Format: mysqladmin -u username -p old password password new password
1. Add a password ab12 to root. First, enter the directory mysqlbin 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 item can be omitted.
2. Change the root password to djg345.
mysqladmin -u root -p ab12 password djg345
(Note: Unlike the above, the following are commands in the MYSQL environment, so they are followed by a semicolon as the command terminator)
3. Modify root on the command line Password:
mysql> UPDATE mysql.user SET password=PASSWORD('New Password') WHERE User='root';
mysql> FLUSH PRIVILEGES; );
For more articles related to using the MySQL command line to change passwords, please pay attention to the PHP Chinese website!