Forget password modification in MySQL under Ubuntu 16

Time:2021-4-19

1. Modify configuration information:

vim /etc/mysql/mysql.conf.d/mysqld.conf
Amend the following information:
[mysqld]
skip-grant-tables
preservation

2. Login to MySQL client:

MySQL - uroot - P carriage return

3. Change Password:

update  mysql.user  set authentication_ String = password ("new password") where user = root;

4. Add users and permissions:

GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;

5. Edit the configuration file and comment out skip grant tables