跳转至

Mysql skip-name-resolve mode


2015-04-03 by dongnan

环境描述

操作系统: CentOS 6.1
软件版本: MySQL 5.1

问题描述

日志出现大量 ignored in --skip-name-resolve mode 字符

tail /var/log/mysqld.log

141021 12:11:31 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
141021 12:11:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
141021 12:11:32  InnoDB: Initializing buffer pool, size = 8.0M
141021 12:11:32  InnoDB: Completed initialization of buffer pool
141021 12:11:32  InnoDB: Started; log sequence number 1 3188369177
141021 12:11:32 [Warning] 'user' entry 'root@db-60' ignored in --skip-name-resolve mode.
141021 12:11:32 [Warning] 'user' entry '@db-60' ignored in --skip-name-resolve mode.
141021 12:11:32 [Note] Event Scheduler: Loaded 0 events
141021 12:11:32 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

操作步骤

检查用户

mysql> select host,password,user from mysql.user;

+--------------------+-------------------------------------------+-----------+
| host               | password                                  | user      |
+--------------------+-------------------------------------------+-----------+
| localhost          |                                           | root      |
| db-60              |                                           | root      |
| 127.0.0.1          |                                           | root      |
| localhost          |                                           |           |
| db-60              |                                           |           |
| %                  | *CFEA530CDCA96B411564866C74CBF73853CA.... | user      |
| localhost          | *CFEA530CDCA96B411564866C74CBF73853CA.... | user      |
+--------------------+-------------------------------------------+-----------+
10 rows in set (0.00 sec)

删除host为"db-60"的用户

mysql> use mysql;
mysql> delete from user where host='db-60';

再次检查用户

mysql> select host,password,user from mysql.user;
+-----------+-------------------------------------------+-----------+
| host      | password                                  | user      |
+-----------+-------------------------------------------+-----------+
| localhost |                                           | root      |
| 127.0.0.1 |                                           | root      |
| localhost |                                           |           |
| %         | *CFEA530CDCA96B411564866C74CBF73853CA.... | user      |
| localhost | *CFEA530CDCA96B411564866C74CBF73853CA.... | user      |
+-----------+-------------------------------------------+-----------+
8 rows in set (0.00 sec)

重启服务

/etc/init.d/mysqld restart

验证

查看日志

tail /var/log/mysqld.log

141021 12:23:53 [Note] /usr/libexec/mysqld: Shutdown complete
141021 12:23:53 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
141021 12:23:54 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
141021 12:23:54  InnoDB: Initializing buffer pool, size = 8.0M
141021 12:23:54  InnoDB: Completed initialization of buffer pool
141021 12:23:54  InnoDB: Started; log sequence number 1 3188369177
141021 12:23:54 [Note] Event Scheduler: Loaded 0 events
141021 12:23:54 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

欢迎关注微信公众号: 运维录

Back to top