Linux MySQL password change 1) If you have not forgotten the password, you can use UPDATE to directly edit the user table to change the password: Enter the database mysql-u rootmysql> use mysql; mysql> UPDATE user SET Password = PASSWORD ('newpass') WHERE user = 'root'; mysql> flush privileges; or/etc/init. d/mysql stop/etc/init. d/mysql start 2) If you have forgotten the password: #/etc/init. d/mysql stop 1. End the currently running mysql process. #/Usr/bin/mysqld_safe -- skip-grant-tables 2. Run in mysql security mode and skip permission verification. # Mysql-u root 3. restart a terminal to log on to mysql as the root user. Mysql> use mysql; 4. Modify the root user password. Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-A Database changedmysql> update user set Password = PASSWORD ('root ') where User = 'root'; Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> exit #/etc/init. d/mysql restart 5. End mysql security mode and run mysql in normal mode. Mysql> update mysql. user set password = PASSWORD ('new password') where User = 'root'; 6. Try your new password mysql> flush privileges; mysql> quit