I have a server (MySQL 8.0.21) that replaces a host name or address with a name that does not exist as a host and thus does not connect. An example:
PS G:\workspace> mysql -u root -p -h geolaptop
Enter password: ********
ERROR 1045 (28000): Access denied for user 'root'@'gut-monitor' (using password: YES)
P
or
PS G:\workspace> mysql -u root -p -h 192.168.1.69
Enter password: ********
ERROR 1045 (28000): Access denied for user 'root'@'gut-monitor' (using password: YES)
PS G:\workspace>
I have set skip-name-resolve to On. I have queried performance_schema.host_cache:
mysql> use performance_schema;
Database changed
mysql> select * from host_cache;
Empty set (0.00 sec)
So how does the host get changed, or better, how to make it stop?
Edit:
server's C:\Windows\System32\drivers\etc\hosts:
...
127.0.0.1 match
127.0.0.1 diet
127.0.0.1 diet-fork
127.0.0.1 df2
127.0.0.1 pma
127.0.0.1 test
127.0.0.1 cr2
127.0.0.1 whodat
192.168.1.69 geolaptop
geolaptop`s host file:
...
127.0.0.1 castlerockhoa
127.0.0.1 hw_errors
192.168.1.76 gwb-10
192.168.1.76 diet-fork
192.168.1.76 gut-monitor
geolaptop, and yet you're trying to connect togeolaptop? Shouldn't you be connecting to the server? Also, the hostname in the error message is that of the client, so I don't think the server is replacing anything. – mustaccio Jul 27 '23 at 17:13mysql -u root -p -h geolaptopis entered at a different computer thangeolaptopnamedgwb-10. It is an attempt to connect to a remote system. If I'm atgeolaptop, I can connect togwb-10without any problem. One should be able to connect to a remote MySQL server from the command line. – geoB Jul 27 '23 at 19:01