MySQL workbench不能连接到服务器

报错:

Your connection attempt failed for user ‘root’ from your host to server at 127.0.0.1:3306:Access denied for user ‘root’@'localhost’

在这里插入图片描述

更改

只要将连接设置中的Hostname “127.0.0.1”改成:“::1”

在这里插入图片描述

即可成功连接到数据库。

在这里插入图片描述

官方解释

Note

The server uses the host cache only for nonlocal TCP connections. It does not use the cache for TCP connections established using a loopback interface address (for example, 127.0.0.1 or ::1), or for connections established using a Unix socket file, named pipe, or shared memory.