The following articles mainly describe the actual application commands for MySQL to change the root password. We all know that there are still many commands for MySQL to change the root password in actual application, the following articles mainly describe the actual application commands, and I hope you will gain some benefits.
MySQL command to change the root password:
Run the MySQL command to change the root password. Switch to the MySQL installation directory under cmd.
Example
- d:/MySQL/bin
Prerequisites: the MySQL root Password is empty.
Enter MySQL-u root MySQL
- MySQL> enter update user set passwordpassword = password ('new password') where user = 'root ';
Echo
- Query OK, 0 rows affected (0.00 sec)
- Rows matched: 2 Changed: 0 Warnings: 0
- MySQL> Status, enter flush privileges;
Echo
- Query OK, 0 rows affected (0.00 sec)
- MySQL> enter quit
Exit SQL
Note that a semicolon ";" must be added after each command ";"
MySQL started to execute this command
The second command updates the database of the MySQL system that has been loaded into the memory.
Restart MySQL.
After the root password is updated, the method for connecting to MySQL is as follows:
New MySQL-uroot-p password. The above content is an introduction to the MySQL Command for modifying the root password. I hope you will get some benefits.