疑问
我们看到用 mysql_secure_installation 安装配置的 mysql-server (mariadb-server),默认的 host 有 localhost, 127.0.0.1 和 ::1 .
那么问题来了,默认情况下,对于 IPv4, localhost 跟 127.0.0.1 应该是等同的。为什么在 mysql 这个数据库的认证记录中,会同时出现 localhost 和 127.0.0.1 两个不同的记录呢?
MariaDB [mysql]> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
| 127.0.0.1 | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
| ::1 | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
+-----------+------+-------------------------------------------+
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
| 127.0.0.1 | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
| ::1 | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
+-----------+------+-------------------------------------------+
继续阅读“Mysql 5.5 的 UNIX Domain Socket 通信方式”