When you use the mysql database to prompt for password errors or permissions, you can start the database in mysql security mode so that all users can access all the tables.
When you use the mysql database to prompt for password errors or permissions, you can start the database in mysql security mode so that all users can access all the tables.
When the mysql database prompts a Password error or a permission error, you can start the database in mysql security mode so that all users can access all tables, you can reset the password or modify the permissions.
1: first shut down the mysql database and end all mysqld processes.
# Service mysqld stop
# Killall-9 mysqld
2: log on to the database in safe mode.
# Mysql_safe -- skip-grant-tables &
3: log on to the mysql database.
# Mysql-uroot
4: Change the user password in the user table.
> Update mysql. user set Password = password ('passwd') where User = "root"
> Flush privileges;
5: grant permissions to the root user.
> Grant all on *. * to 'root' @ '%' identified by 'passwd ';
> Flush privileges;
Then you can use the root user and PASSWD password to log on to the mysql database. According to the above method, when other users forget the password, they can modify the password and grant permissions to the user.
Recommended reading:
Percona_Toolkit introduction and installation-a required tool kit for MySQL Administrators