1.sudo cat /etc/mysql/debian.cnf

2.mysql -u debian-sys-maint -p
复制上一步拿到的密码,输入password
3.修改密码
use mysql;
update mysql.user set authentication_string=password('123123') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
quit;
4.重启mysql
service mysql restart
网友评论