6

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?

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, I thought of this and did a dig and the externalit FQDN resolves to a different IP. If it is the case that it's just DNS output, then I guess the server admin has some work to do...
@mbcook - seeing a similar problem. I don't have an /etc/host file on my machine.. Any other thoughts on what I could try?
2

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

Comments

2

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)

2 Comments

Same here, for the same DNS-related issue.
Adding the protocol (even without hostname, as I am on localhost) did the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.