Find the mysql configuration file my.cnf
find / -name my.cnf
Edit my.cnf
vim my.cnf
#在[mysqld] 下方添加
skip-grant-tables
# 然后保存退出
restart mysql
There is no need to enter a password to enter mysql at this time
mysql -uroot -p
# -u后面跟用户名
Update the user table password in the mysql library
#设置新密码
update mysql.user set authentication_string=password(<