【环境介绍】
系统环境:Red Hat Enterprise Linux 7 + 5.7.25-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
【情况描述】
在安装完数据库之后,查看日志出现多个Warning信息:
2019-04-26T17:28:33.605994+08:00 0 [Note] Server socket created on IP: '::'.
2019-04-26T17:28:33.652894+08:00 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2019-04-26T17:28:33.653069+08:00 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-04-26T17:28:33.653099+08:00 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2019-04-26T17:28:33.653630+08:00 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-04-26T17:28:33.653648+08:00 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2019-04-26T17:28:33.654222+08:00 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2019-04-26T17:28:33.707215+08:00 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-04-26T17:28:33.707301+08:00 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
【情况分析】
skip_name_resolve参数说明:
此变量是根据--skip-name-resolve选项的值设置的。 如果是OFF,mysqld检查客户端连接时解析主机名。 如果它是ON,mysqld只使用IP号码;
在这种情况下,授权表中的所有主机列值必须是IP地址或localhost。数据库验证主机来源,服务器要执行DNS的正向和反向查找,如果DNS出问题,会堆积起来,最终导致连接超时,建议设置该参数。
查看--skip-name-resolve参数信息:
root@(none) 08:45:14>show variables like 'skip_name_resolve';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| skip_name_resolve | ON |
+-------------------+-------+
1 row in set (0.01 sec)
root@(none) 08:45:38>system cat /etc/my.cnf|grep skip_name_resolve
skip_name_resolve = on
root@(none) 08:45:50>
查看用户信息:
root@(none) 08:34:30>select distinct User,Host from mysql.user;
+---------------+-----------+
| User | Host |
+---------------+-----------+
| tuan | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
4 rows in set (0.12 sec)
root@(none) 08:43:17>
官方参数信息:
该数据库是新搭建的,没有其他操纵,且初始化时并没有报错,在MOS上面查询,查看跟相似BUG 23329861 - WARNING ABOUT LOCALHOST WHEN USING SKIP-NAME-RESOLVE
查看该BUG信息,该BUG将在5.7.26进行修复:
描述信息跟BUG一致:
查看官方5.7.26文档对此BUG的描述:
【对数据库进行升级修复】
升级过程忽略,查看错误日志信息,已经修复waring:
[Warning] Plugin audit_log reported: 'Audit Log plugin supports a filtering, which has not been installed yet. Audit Log plugin will run in the legacy mode, which will be disabled in the next release.'
为相应的表及函数没有创建:
Linux and Unix:share/audit_log_filter_linux_install.sql
Windows:share/audit_log_filter_win_install.sql
mysql>SOURCE /share/audit_log_filter_linux_install.sql
mysql> CREATE FUNCTION audit_log_read_bookmark RETURNS STRING SONAME 'audit_log.so';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE FUNCTION audit_log_read RETURNS STRING SONAME 'audit_log.so';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE FUNCTION audit_log_encryption_password_set RETURNS INTEGER SONAME 'audit_log.so';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE FUNCTION audit_log_encryption_password_get RETURNS STRING SONAME 'audit_log.so';
Query OK, 0 rows affected (0.00 sec)