I can't connect to mysql database becase it alway change to ubuntu.local.

$ mysql -uroot -padmin1234 -h192.168.1.101
ERROR 1045 (28000) : Access denined for user 'root'@'ubuntu.local' (using password: YES)

How do I solve this problem.

File: /etc/hosts in this machine   localhost   ubuntu.ubuntu-domain    ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

I have no idea about "root'@'ubuntu.local", where is it come from.


4 Answers 4


The "ubuntu.local" probably comes from the MySQL server machine, not the client from which you are trying to connect. Check /etc/hosts on that machine for an entry relating to (or whatever your client machine's IP is). It may also (unlikely) be getting that name from Reverse DNS set up somewhere (maybe your router?).

The access denied statement is simply MySQL declining the host/username/password . Try

select * from mysql.users where user = 'root';

And see if anything comes back listing the client machines IP address or hostname. Make sure the passwords are the same (root@localhost can have a different password than root@someothermachine.com).


Use localhost instead of

In fact, why specify it at all?

You may be trying to login to mysql as root, but the error message indicates you're logged into Ubuntu as root also. This is not necessary. The two 'root' users are entirely different.

Log into Ubuntu as a normal user. Then log into mysql as root (is that the right password for the mysql root user? Did you assign the mysql root password when you installed mysql? If you didn't then it probably has no password).

Then assign rights (GRANT) for the normal Unbuntu user to access mysql.

  • @pavium != localhost it is another machine and i'm loged in as normal user not root
    – bugbug
    Oct 1, 2009 at 8:21
  • 1
    Ah I see ... so you're trying to connect to mysql on from your local machine, which mysql seems to refer to as ubuntu@local. Does the mysql root user have permissions (ie GRANTs) to login from ubuntu.local, and/or is the password correct?
    – pavium
    Oct 1, 2009 at 10:08


This link has all the info you need to configure you mysql on ubuntu to work, if you are trying to access it from another machine (non local).

Mahesh Velaga.


The resolution in the error is being performed by the remote server running MySQLd.

If your GRANT is specifying a hostname then the forward and reverse DNS need to match. Which it seems they don't regardless.

Check your GRANT and check DNS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy