reason:
solution:
Enable cmd to log in to mysql and execute the following commands in sequence:
use mysql;
select 'host' from user where user='root';
update user set host = '%' where user ='root';
flush privileges;
The result is as follows:
Just reconnect.