开发者

mysql client connection hostname question

Have a question that I can't seem to find an answer for. I am trying to connect to a remote database. I ty开发者_如何学Gope 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?


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).


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:

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜