1. Have the original root password of mysql
Method ① Log into the mysql system
Enter the command: mysql -u root -p
Enter password:(newpassword)
Enter mysql to write mysql statement
Use mysql
change Password
Make it effective
Quit mysql
Method ②
Outside of MySQL, use commands to modify
Enter password: (Enter new password)