Windows: 1. Log in with the system administrator. 2. Stop the service of MySQL. 3. Go to the command window, then enter the mysql installation directory, such as my installation directory is c: / mysql, enter c: / mysql / bin 4. Skip permission check start mysql, c: / mysql / bin> mysqld-nt --Skip-grant-tables 5. Re-opening a window, enter the c: / mysql / bin directory, set the new password of the root C: / mysql / bin> mysqladmin -u root flush-privileges password "newpassword" C: / mysql / bin> mysqladmin -u root -p Shutdown Replace NewPassword to the root password you want to use, the second command will prompt you to enter the new password, repeat the password entered by the first command. 6. Stop MySQL Server, start MySQL 7 with normal mode. You can link to MySQL with a new password. Unix & Linux: 1. Use root or user login system that runs mysqld; 2. The process of extracting the mysqld by using the kill command; Start the mysql server shell> mysqld_safe --skip-grant-tables & 4. Setting the new password shell> mysqladmin -u root flush-privals password "NewPassword" 5. Restart mysql server