Reprint please specify the source http://blog.csdn.net/yc7369
Various methods of MySQL password change
We have compiled the following four ways to change the root password in MySQL, which may help!
Method 1: Use the Set password command
Mysql-uroot
Mysql>set PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ');
Method 2: Use Mysqladmin
mysqladmin-u root Password "Newpass"
If Root has already set a password, use the following method
mysqladmin-u root password Oldpass "Newpass"
Method 3: Edit the user table directly with update
Mysql-uroot
Mysql>use MySQL;
Mysql>update user SET Password = Password (' newpass ') WHERE user = ' root ';
Mysql>flush privileges;
This can be done when the root password is lost
mysqld_safe--skip-grant-tables&
Mysql-uroot MySQL
Mysql>update user SET Password=password ("New password") WHERE user= ' root ';
Mysql>flush privileges;
The following statements are available in MySQL 5.6, and the other versions should be similar
Reprint please specify the source http://blog.csdn.net/yc7369