mysql skip-name-resolve locahost

localhost は特別扱いで unix ソケットを使用した接続になる
→ skip-name-resolve しても「接続元ホスト」は localhost

On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs: the client connects using a Unix socket file. The --socket option or the MYSQL_UNIX_PORT environment variable may be used to specify the socket name.
...

For example, with --host=localhost on Unix, the client attempts to connect to the local server using a Unix socket file, even if a --port or -P option is given to specify a TCP/IP port number.

https://dev.mysql.com/doc/refman/5.7/en/connecting.html

[19 May 2016 22:25] monty solomon

The hostname "localhost" is a special case and it works even when skip_name_resolve is set.

Here is an excerpt from the manual

https://dev.mysql.com/doc/refman/5.7/en/connecting.html

On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs.

mysql> select @@skip_name_resolve\G
*************************** 1. row ***************************
@@skip_name_resolve: 1
1 row in set (0.00 sec)

mysql> status
--------------
Current user:		test_user@localhost
Connection:		Localhost via UNIX socket

https://bugs.mysql.com/bug.php?id=81441

参考

第28回 MySQLと名前解決、skip-name-resolve | gihyo.jp

skip-name-resolve重要 - hiroyのブログ