sudo cat /etc/mysql/debian.cnf
文件内容如下
[client]
host = localhost
user = debian-sys-maint
password = voWlZ5cZNV266m8
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = voWlZ5cZNV26k6m8
socket = /var/run/mysqld/mysqld.sock
mysql -udebian-sys-maint -pvoWlZ5cZNV26k6m8
use mysql;
select Host,User,authentication_string from user;
update user set authentication_string=‘‘ where user=‘root‘;
ALTER user ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘root‘;
flush privileges;
mysql -uroot -proot
原文:https://www.cnblogs.com/hu308830232/p/15005445.html