2014
MariaDBERRORCommonAccess ControlHIGH confidence

Host is not allowed to connect

Production Risk

High — application cannot connect.

What this means

The client host is not permitted to connect to the MySQL server based on the host-based access control configuration. No user account grants access from this host.

Why it happens
  1. 1No MySQL user account has been created with access from this host.
  2. 2User account exists only for localhost or a different host pattern.
  3. 3DNS reverse lookup returning a different hostname than expected.
How to reproduce
trigger — this will error
trigger — this will error
-- Occurs at connection time; no SQL statement needed

expected output

ERROR 2014 (HY000): Host '203.0.113.5' is not allowed to connect to this MySQL server.

Fix 1

Create or update the user account to allow the connecting host

Create or update the user account to allow the connecting host
CREATE USER 'app_user'@'203.0.113.5' IDENTIFIED BY 'password';
GRANT SELECT, INSERT ON mydb.* TO 'app_user'@'203.0.113.5';
FLUSH PRIVILEGES;

Why this works

A matching user@host entry in the grant tables allows the connection.

Fix 2

Use a wildcard host if connecting from multiple addresses

Use a wildcard host if connecting from multiple addresses
CREATE USER 'app_user'@'%' IDENTIFIED BY 'password';

Why this works

% matches any host, but should be used cautiously in production.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 2014 ER_HOST_NOT_PRIVILEGED

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors