ID #1024

I get error 1130 "Host is not allowed to connect ..." or "Access denied ..." or "Could not connect ..."


Error 1130 is a networking error. The server cannot resolve the hostname of the client. Or the host is not allowed to connect to the MySQL server.

There are basically 2 categories of possible reasons:

* The simple one:

In MySQL a user a user is specified using BOTH the user name and the host from where the user may connect. If no user has been created where the host-part (using wildcards or not) mathces the host of the client trying to connect MySQL will return this error.

* Specific for MySQL 5.7:

When upgrading to MySQL 5.7.3 from a previous version this may occur due to changes to the user table introduced in 5.7.3. There is a good blog about this here

* The tricky ones:


Your hosts file is damaged or invalid. Various vira and spyware attack and alter the host file in various ways. For instance if the hosts file does not contain the line localhost

'localhost' cant' be resolved as pointing to ip On some larger corporate network it is widely used to "roll out" host files to all clients with symbolic names (like 'mysqlserver', 'mailserver' etc.) for important machines on the network and the corresponding ip's. Check with your admin that you got the right file!


If you use the Windows network name as hostname, it may be a network configuration problem. Try using the ip instead.


On Unix/Linux systems the hosts files sometimes reads localhost.localdomain

This causes a problem with MySQL. MySQL docs at say:

A Host value may be a hostname or an IP number, or 'localhost' to indicate the local host.

No mention of 'localhost.localdomain'. This means that MySQL can't resolve that 'automatically'! This can affect SQLyog when tunneling and SJA for Linux. Workarounds for this include:

A workaround that has worked is to give the user access from 'localhost.%'

You can add localhost to ip in host file like

a) make sure your '/etc/hosts' file reads as follows: localhost //localhost *MUST* be first (notice separate entries) localhost.localdomain . . .

b) make sure you reference the local server in the SJA.XML file as: or localhost.localdomain

This is known to work in some situations where the MySQL configuration file contains:
bind-address =

It has sometimes worked to add a 'dummy' ip to my.cnf like:
bind-address =

.. supposed that 10.10.10.x is also the ip of the local machine. Then you use this 'dummy ip' as the host specification when connecting with SQLyog and SJA.

It seems to be something special for some DEBIAN distributions to use this 'bind-address' construction with MySQL. Solution II) and III) both are solutions that users have contributed at our Forums. Both situations involved DEBIAN.

You can try any host name that the host file maps to ip There might be several! Even a SAMBA NetBIOS alias might work!

You can use the local ip (ie. or whatever) of the actual machine or a name server alias for this. But in this case normal TCP-connections must be enabled in MySQL configuration - that is 'skip-networking' must be disabled/commented out and no 'bind-address' may be there. Of course then an additional DNS lookup will have to take place for the connection to be established. This is of no practical importance!


.. is a variation of 3). With a complex server setup (involving more ip's, domains, subdomains and/or virtual hosts) a similar issue can occur.

In this situation HTTP-tunneling will normally work for all users, but often/sometimes direct connection and SSH will not work with the 'root' user - everything depending on the server configuration. Try another and 'ordinary' user account. You may mirror the privileges of 'root' to a 'superadmin' user.

Finally you could test if this connection issue is the same with 'MySQL Administrator'. It uses the same client code (the C-API) and connects exactly as SQLyog and SJA do.


Tags: -

Related entries:

You can comment this FAQ

Comment of Peter Laursen:
I am sorry that the FAQ did not solve your problems. Now everyone would notice that this FAQ article is the mostly viewed here. That teells there is a problem. But it is not a problem with SQLyog, the problem is that some *nix distributions have (in an undocumented way) different host and domain configurations. Of course we would like to give better advices on this. But this is the information that we are able to give - and any user being able to give a more precise answer should preferably do so!
Added at: 2007-03-10 10:42

Comment of Mendle:
Ok this is nice and all but my thing works perfeclty for because that points the source internaly inside the comp and local host is just a shortened way to do it. My problem is when i try to set it up for my IP adress so as the server break between my LAN networking this error pops in. Ive read through this and have seen it tells just enough to not say anything at all to help me... If u can figured out my problem send me an Email or sumthign cause this is severly drawing my paitence.
Added at: 2007-03-14 01:57

Comment of Olov:
This does not seem to be a networking error. In the test below I run the MySQL server and client on the same host (WinXP professional). When I replace "localhost" with its IP-adress , version 4.1.8-nt works but not 5.0.15-nt .

Is this a MySQL bug?

server version: 5.0.15-nt
C:\>mysql -u root -h localhost
Welcome to the MySQL monitor.
Your MySQL connection id is 3 to server version: 5.0.15-nt

C:\>mysql -u root -h
ERROR 1130 (00000): #HY000Host 'MyHost.lan' is not allowed to connect to this MySQL server

server version: 4.1.8-nt
D:\>mysql -u root -h localhost
Welcome to the MySQL monitor.
Your MySQL connection id is 6 to server version: 4.1.8-nt

D:\>mysql -u root -h
Welcome to the MySQL monitor.
Your MySQL connection id is 7 to server version: 4.1.8-nt
Added at: 2007-04-13 08:45

Comment of Atmapuri:

Maybe this topic has so high view count because it is first obstacle in the "getting started" section. When you start MySQL Administrator, there is a Host, user and passw requested. If you installed this on a local machine and dont know the right user or passw or host name, this will result in exactly this error. (1130). A good start is to put localhost as the host, root as the username and the password as specified during the Wizard setup of the DB. Oh yes, I forgot, you have to read the 500 page manual first how to build your DB, tables and queries from command line, before you can continue from here onward

Added at: 2008-06-16 16:43

Comment of Eli R.:
I have a mySQL database hosted on an external server soemwhere Brooklyn. Its IP is NN.139.34.10 (NN are two digits).
I am trying to connect from home (not in NY) to the DB.
I get an error 1130. In the message box I see that the IP I entered has dashes instead of periods, and my ISP's DNS server id is concatenated to it. For example:
Any idea what's causing it and how to OVERCVOME it?
Added at: 2009-12-01 17:42

Comment of Peter Laursen:
@Eli .. please do not use the FAQ for asking support. We have Forums for this. You can comment in the FAQ if you want to add information to a FAQ - or if you disagree wiht something written here of course)

Please read the FAQ 'about this FAQ'. Do not use the FAQ for *interactive support*.

And if you face a problem with SQLyog please start a discussion in our Forums instead.
Added at: 2009-12-01 17:51