sudo cat /etc/mysql/debian.cnf

mysql -u debian-sys-maint -p
//注意!
//这条指令的密码输入是输入第一条指令获得的信息中的 password = ZCt7QB7d8O3rFKQZ 得来。
//请根据自己的实际情况填写!

修改密码
use mysql;
// 下面这句命令有点长,请注意。
update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
quit;

重新启动mysql
转载自:https://blog.csdn.net/qq_38737992/article/details/81090373
网友评论