mysql如何做IP地址的反向解析? [英] How does mysql do reverse resolution of IP addresses?

查看:112
本文介绍了mysql如何做IP地址的反向解析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们重新启动了一台运行 mysql 的机器,但我们遇到了一些奇怪的问题.来自其他机器的大多数进程都能够毫无问题地连接.如果我们通过环回地址显式连接,我们也可以在本地连接.

这有效:

mysql -hlocalhost -utest_user -psecret_password

当我们运行命令时:

mysql -h192.168.1.10 -utest_user -psecret_password

在本地机器上,我们收到以下错误:

ERROR 1045 (28000): 用户`test_user`@`SERVER_123` 的访问被拒绝

我们有以下用户:

test_user@localhost测试用户@%

我们已通过添加以下用户解决了该问题:

test_user@SERVER_123

其中 SERVER_123 是机器的非限定名称.我们不知道为什么必须添加额外的用户,我们不想保留它,但我们也不知道为什么添加它可以解决问题.

为什么从本地机器连接,通过IP(即mysql -ha.bcd -utest_user -ppsswd)无法匹配test_user@%用户,但会匹配test_user@machine_name,其中machine_name是机器的非限定名称?

这是用户表

<前>匿名的 %匿名SERVER_123匿名本地主机test_user_2 %test_user_3 %根::1根 127.0.0.1根服务器_123根本地主机

注意:找出问题.以某种方式重新启动机器必须改变了 192.168.1.10 的解析方式,以便它解析为 SERVER_123.然后导致来自 192.168.1.10 的登录匹配 test_user@SERVER_123.

解决方案

发现问题.有一个匿名用户在特定用户之前匹配.我不确定在重新启动期间发生了什么导致反向分辨率改变,但我们有一个用户 ''@'SERVER_123' 必须已经开始匹配.删除匿名用户解决了这个问题,我们不再需要 test_user@SERVER_123 的权限.

We rebooted a machine running mysql, and we're having some odd issues. Most processes from other machines are able to connect to without issue. We can also connect locally if we connect through the loopback address explicitly.

This works:

mysql -hlocalhost -utest_user -psecret_password

When we run the command:

mysql -h192.168.1.10 -utest_user -psecret_password

locally on the machine we get the following error:

ERROR 1045 (28000): Access denied for user `test_user`@`SERVER_123`

We had the following users:

test_user@localhost
test_user@%

We have fixed the issue by adding the following user:

test_user@SERVER_123

Where SERVER_123 is the unqualified name of the machine. We don't know why we had to add that additional user, and we don't want to keep it, but we also don't know why adding it fixed the issue.

Why does connecting from the local machine, via IP (i.e. mysql -ha.b.c.d -utest_user -ppsswd) fail to match the test_user@% user, but will match test_user@machine_name, where machine_name is the unqualified name of the machine?

Here is the user table

anonymous    %
anonymous    SERVER_123
anonymous    localhost
test_user_2  %
test_user_3  %
root         ::1
root         127.0.0.1
root         SERVER_123
root         localhost

Note: Figured out the issue. Somehow rebooting the machine must have changed how 192.168.1.10 resolved so that it resolved to SERVER_123. That then caused logins from 192.168.1.10 to match test_user@SERVER_123.

解决方案

Found the issue. There is an anonymous user which is matching before the specific user. I'm not sure what happened during the reboot that caused reverse resolution to change, but we had a user ''@'SERVER_123' which must have started matching. Removing the anonymous user fixed the issue, and we no longer need to have privileges for test_user@SERVER_123.

这篇关于mysql如何做IP地址的反向解析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆