解决办法:
1. 跳过秘密验证
修改密码: vim /etc/my.cnf 中添加 skip-grant-tables
修改密码:[root@centos-linux bin]# ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.18 MySQL Community Server - GPL
然后去掉skip-grant-tables
2. 重制密码为123456sww,如下
mysql -u root -p
// 回车
// 将密码修改为123456sww
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456sww';
3. 用新密码链接mysql,登录成功!