MySQL multiple ways to change the root password
Method 1: Use the Set password command
Mysql-u Root
MySQL multiple ways to modify root password Method 1: With Set PASSWORD command mysql-u root mysql> set PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ') ; Method 2: Use mysqladmin mysqladmin-u root password "Newpass" If Root has been set password, use the following method mysqladmin-u root password Oldpass "Newpas S "Method 3: Edit user table directly with update mysql-u root mysql> use MySQL; mysql> UPDATE user SET Password = Password (' newpass ') WHERE user = ' root '; mysql> FLUSH privileges; When you lose the root password, you can mysqld_safe--skip-grant-tables& mysql-u root mysql mysql> UPDATE User SET Password=password ("New password") WHERE user= ' root '; mysql> FLUSH privileges;
MySQL multiple ways to change the root password