You can use the MySQL command line to modify the password of the MySQL database. The following describes the MySQL Command Line in detail. If you are interested, take a look.
Format: mysqladmin-u username-P old Password New Password
1. Add a password ab12 to the root user. First, enter the MySQL \ bin directory under DOS, and then type the following command
Mysqladmin-u root-Password ab12
Note: because the root account does not have a password at the beginning, the old-P password can be omitted.
2. Change the root password to djg345.
Mysqladmin-u root-P ab12 password djg345
(Note: Unlike the above, the following commands in the MySQL environment are followed by a semicolon as the command Terminator)
3. Change the root password through the command line:
Mysql> Update mysql. User SET Password = PASSWORD ('new password') where user = 'root ';
Mysql> flush privileges;
4. display the current user:
Mysql> Select User ();
1. Disable the MySQL service.
2 With */bin/mysqld-nt.exe to start the process
3. Run the following command: mysqld-NT -- skip-grant-tables.
4> use MySQL;
> Update user SET Password = PASSWORD ('20140901 ');
5. Shut down the mysqld-nt process and restart MySQL. Run mysql-u root-P 123.
Open a new cmd window and perform the following command operations:
1. mysql-uroot
2. Update mysql. User SET Password = PASSWORD ('root') where user = 'your password ';