Maria DB Connection Error. Host not allowed

This just started happening. I haven’t made any changes to anything or done any updates. My history and recorder components won’t start because of this error in the logs:

Error during connection setup: (MySQLdb._exceptions.OperationalError) (1130, “Host ‘core-samba.local.hass.io’ is not allowed to connect to this MariaDB server”)
(Background on this error at: http://sqlalche.me/e/e3q8) (retrying in 3 seconds)

I tried changing the host entry in maria db to “host”: “%”, but it didn’t fix it.
This is my maria db config

{
  "databases": [
    "homeassistant"
  ],
  "logins": [
    {
      "username": "hass",
      "host": "homeassistant",
      "password": "somepassword"
    }
  ],
  "rights": [
    {
      "username": "hass",
      "host": "%",
      "database": "homeassistant",
      "grant": "ALL PRIVILEGES ON"
    }
  ]
}

Im running 0.96.5. This has been working fine for about a month since I switched over to maria db. Anyone know what I can do to fix it?

So I think I got it fixed. I found this thread talking about a supervisor auto update that messed up some dns functions in HA.

Not sure if that was my issue but I changed this line in my configuration.yaml file from

recorder:
  db_url: mysql://hass:mypassword@core-mariadb/homeassistant

to

recorder:
  db_url: mysql://hass:[email protected]/homeassistant

Maybe it does in fact have a dns issue and cant resolve core-mariadb so putting the local host ip address fixes it?? Who knows. But it worked. No more errors and now I can view history.

1 Like

Had the same problem

…not allowed to connect to this MariaDB server…

, but found different solution:

Setting the host to % in the mariadb plugin config solved the issue for me:

{
  "databases": [
    "homeassistant"
  ],
  "logins": [
    {
      "username": "hass",
      "host": "%",
      "password": "...."
    }
  ],
  "rights": [
    {
      "username": "hass",
      "host": "%",
      "database": "homeassistant",
      "grant": "ALL PRIVILEGES ON"
    }
  ]
}