mysql客户端连接主机名问题

发布于 2024-08-17 04:42:50 字数 408 浏览 10 评论 0原文

有一个我似乎找不到答案的问题。我正在尝试连接到远程数据库。我在 Ubuntu shell 中输入以下内容:

mysql -u test -h mysql.domain.com -p

mysql 询问我的密码,然后输出以下内容:

ERROR 1045 (28000): Access denied for user 'test'@'externalit.domain.com' (using password: YES)

问题是我不在 externalit 上。我在一个完全不同的主机上。我认为我所在的服务器是从 externalit 克隆的,但我没有设置服务器。我的问题:mysql 是否有一个conf 文件或其他设置可能会自动输入错误的主机名?我可以改变这个吗?

Have a question that I can't seem to find an answer for. I am trying to connect to a remote database. I type in the following to my Ubuntu shell:

mysql -u test -h mysql.domain.com -p

mysql asks for my password and then outputs the following:

ERROR 1045 (28000): Access denied for user 'test'@'externalit.domain.com' (using password: YES)

The problem is that I am not on externalit. I am on a completely different host. I think that the server I am on was cloned from externalit, but I didn't set the server up. My question: does mysql have a conf file or other setting that may be automatically entering an incorrect hostname? Can I change this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

原谅我要高飞 2024-08-24 04:42:50

这是服务器认为与您的 IP 地址相符的名称。这可能是针对 DNS 设置(它正在尝试反向 DNS),或者 /etc/host 文件中的某些内容(将该 IP 映射到该主机)。

That's the name that the server thinks goes with your IP address. It could be do to a DNS setting (it's trying a reverse-DNS), or something in the /etc/host file (mapping that IP to that host).

淡墨 2024-08-24 04:42:50

您需要确保您连接的计算机上的反向 DNS 与用户的地址匹配。
如果您使用共享 IP 或无法控制反向 DNS,则将用户的权限更改为“test”@“%”,这将允许来自任何 IP 地址的任何人进行连接,只要他们拥有正确的用户名/密码对。当然,这会带来一些安全问题。

您可以阻止 mysql 进行反向查找,然后使用“test”@“123.123.123”作为用户/主机,但除非您使用可能导致问题的固定 IP。

直流

You need to make sure the reverse DNS on the machine you are connecting from matches the address for the user.
If you are on a shared IP or can't control the reverse DNS then change the permissions on the user to 'test'@'%' this will allow anyone from any ip address connect as long as they have the correct username/password pair. of course this opens up some security issues.

You can prevent mysql from doing reverse lookups and then use 'test'@'123.123.123' as the user/host but unless you are on a fixed IP that could cause issues.

DC

森林迷了鹿 2024-08-24 04:42:50

尝试添加协议选项:

mysql -u test -h mysql.domain.com --protocol=tcp -p

和/或尝试显式添加端口:(

mysql -u test -h mysql.domain.com -P3306 --protocol=tcp -p

请参阅:

Try adding a protocol option:

mysql -u test -h mysql.domain.com --protocol=tcp -p

and/or try adding a port explicitly:

mysql -u test -h mysql.domain.com -P3306 --protocol=tcp -p

(see: http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_protocol)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文