mysql客户端连接主机名问题
有一个我似乎找不到答案的问题。我正在尝试连接到远程数据库。我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是服务器认为与您的 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).
您需要确保您连接的计算机上的反向 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
尝试添加协议选项:
和/或尝试显式添加端口:(
请参阅:
Try adding a protocol option:
and/or try adding a port explicitly:
(see: http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_protocol)