mysqldude
Error codes › 1130

MySQL & MariaDB error 1130: Host is not allowed to connect to this MySQL server

MySQLHost '…' is not allowed to connect to this MySQL server
MariaDBHost '…' is not allowed to connect to this MariaDB server

No account at all matches the host you connect from, so the server refuses before checking the user name or password. Create an account for your host, or connect from an allowed one.

MySQLMariaDB
SymbolER_HOST_NOT_PRIVILEGEDER_HOST_NOT_PRIVILEGED
SQLSTATEHY000HY000
TypeServer errorServer error
Versionsevery release since 5.0 activeevery release since 5.5 active

What it means

The message names the host as the server sees it: Host '10.0.3.7' is not allowed to connect to this MySQL server. The server checked every row in its account list and found no 'user'@'host' whose host part matches your address, for any user. It refuses straight away, without looking at the user name or password.

This differs from 1045: with 1045 some account matched your host, but the user name or password didn’t fit.

Why it happens

  • Fresh installs only create accounts for localhost (and often 127.0.0.1 / ::1), so the first remote connection, from another server or a Docker container, gets 1130.
  • The account exists for a specific address ('app'@'10.0.1.%') and the client now connects from another one: a new subnet, a NAT gateway, or a container network.
  • With name resolution enabled, the server matches the reverse DNS name of your address. If that doesn’t resolve as expected, an account defined by host name won’t match.
  • After too many failed connection attempts from one host the server blocks it, which gives a different error (1129) until FLUSH HOSTS (or TRUNCATE performance_schema.host_cache).

How to fix it

  • Check which host the server sees: the message tells you. Then create an account for it: CREATE USER 'app'@'10.0.3.%' IDENTIFIED BY '…'; and grant what it needs. Prefer a subnet pattern over '%'.
  • Check that the server listens on the network at all (bind_address), otherwise you get 2003 instead.
  • From a machine that can log in, SELECT user, host FROM mysql.user; shows which hosts are allowed.

The test servers used on this site all have a 'root'@'%' account, which matches every host. That’s why 1130 isn’t reproduced here: it needs a server with no wildcard accounts.

Related errors

  • 1045 ER_ACCESS_DENIED_ERRORexplained
  • 2003 CR_CONN_HOST_ERRORexplained
  • 1698 ER_ACCESS_DENIED_NO_PASSWORD_ERRORexplained