When mysql modifies the ROOT user password and forgets the ROOT password, www.2cto.com 1. Edit the mysql configuration file: % mysql_installdir % \ my in windows. ini // generally, my is in the MYSQL installation directory. ini is the MYSQL configuration file. In linux:/etc/my. cnf Add the following line in the [mysqld] configuration section: skip-grant-tables save and exit editing. 2. Restart mysql in windows: net stop mysqlnet start mysqllinux:/etc/init. d/mysqld restart 3. Set the new ROOT password and then run mysql-uroot-p mysql on the command line to enter the database without a password. Run the following statement to update the root password to 7758521: update user set PASSWORD = password ("7758521") where user = 'root'; quit to exit MYSQL. 4. Restore the configuration file, restart the service, and modify the mysql configuration file to delete the line added. Restart the MYSQL service again and the password is changed.