my.cnf中添加:

skip-grant-tables

回到MySQL目录重启mysql服务

cd /opt/soft/mysql-5.7.30
service mysql restart

登录mysql:

mysql -uroot -p

使用mysql数据库:

use mysql 

修改密码:

UPDATE mysql.user SET authentication_string=PASSWORD('新密码') WHERE User='root'; FLUSH PRIVILEGES;
最后修改:2024 年 01 月 24 日
咱们谁跟谁,用不着~