The modified users are listed as root.
First, know the original MYQL database root password;
①: Enter mysqladmin-u root-p password "New password" return in terminal command line, enter password: "Enter old password"
②: Log in to MySQL system changes, mysql-uroot-p Enter Password: "Enter the original password"
mysql> usemysql;
mysql> Update user set Password=password ("New password") where user= ' root '; "Password Note case"
Mysql> flush Privileges;
Mysql> exit;
You can then log in using the new password you just entered.
Second, do not know the original myql root password;
First, you must have root access to the operating system. If you do not have the root authority of the system, consider the root system before taking the following steps. Similar to Safe Mode login system.
The MySQL service needs to be stopped first, there are two cases, one can use service mysqld stop,
The other is /etc/init.d/mysqld stop
When prompted that MySQL has stopped after the next operation shutting down MySQL. Success!
In terminal command line input
Mysqld_safe--skip-grant-tables & "Log in to MySQL system"
Enter MySQL login mysql system
mysql> use mysql;
mysql> UPDATE user SET Password=password ("New password") WHERE user= ' root '; "Password Note case"
Mysql> flush Privileges;
Mysql> exit;
Restarting the MySQL service
This will set the new root password to succeed.
Third, modify the root login permissions
This is likely to happen when you modify the root password.
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
This is because the root login permissions are insufficient, the specific modification method is as follows
The MySQL service needs to be stopped first, there are two cases, one can use service mysqld stop,
The other is /etc/init.d/mysqld stop
When prompted that MySQL has stopped after the next operation shutting down MySQL. Success!
In terminal command line input
Mysqld_safe--skip-grant-tables & "Log in to MySQL system"
Enter MySQL login mysql system
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>select host, user from user;
Mysql> flush Privileges;
Mysql> exit;
Then restart the MySQL service to do so.
Linux to modify the use of MySQL (root password and modify the root login permissions