Hass.io and database?

Hello,

I’ve installed a normal version of Home Assistant on my Pi3 (I’m still happy with it).
However HassIO seems very interesting…
But I wonder about the database. I’m using right now MySQL because the default database of hass became so large… (the’re many topics about it)…
What about HassIO? Can you install or choose your database as well?

1 Like

Hi @broesie, there’s a MariaDB addon available for Hass.io.
You can use it the same way as MySQL.

Edit: You can also use an existing MySQL Server with Hass.io.
Recorder to MySQL fails

I installed the mariadb addon, do I have to change any of the default options?
{ “databases”: [ “homeassistant” ], “logins”: [ { “username”: “hass”, “host”: “%”, “password”: null } ], “rights”: [ { “username”: “hass”, “host”: “%”, “database”: “homeassistant”, “grant”: “ALL PRIVILEGES ON” } ] }

Hi @Marauder2, like stated in the docs, i only changed the host to ‘%’, to access the DB from outside Hass.io.

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

Thanks @VDRainer.

When I installed it, it shows the default settings:

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

If I try to click to edit it, the “save” button goes gray. Not sure how to add a password and save the settings.

The ‘SAVE’ Button goes gray if there’s any problem with the json format of the config.
If i reset to defaults, and delete the ‘null’ the Button goes gray.
When i type a "password" (with doublequotes), it gets active again.

@VDRainer, ah thank you! My mistakes was not typing the double quotes…

once installed, how to access the DB?

You can access the db via shell script or python script, …
There are many SQL Clients available.
For simply looking at the data i prefer SQuirreL.

thanks!
Which address as URL?

Here’s my alias to connect to the DB.
Auswahl_042
You have to change the IP and the database name.

1 Like

I receive this

HASS: JDBC Driver class not found
class java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver

in option I have this

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

Looks like you need the MySQL DB Driver.

Once you have switched to MariaDB is it safe to delete home-assistant_v2.db ?

It’s always save to delete the home-assistant_v2.db, but you loose your history.
HA creates a new one if not found on startup.

1 Like

Searching the forum for an answer for my question and I found this post. I have the MarioDB working, but I can’t connect to it from my laptop with Squirrel.

But when I try to connect I get this message:

Hassio: Host '192.168.1.134' is not allowed to connect to this MariaDB server
class java.sql.SQLException: Host '192.168.1.134' is not allowed to connect to this MariaDB server

I try to connect with: jdbc:mysql://192.168.1.111:3306/homeassistant

In Hassio I have the following data from MariaDB:

  "rights": [
    {
      "username": "hass",
      "host": "homeassistant",
      "database": "homeassistant",
      "grant": "ALL PRIVILEGES ON"

Any hints…?

Have you tried it with
"host": "%", ?

2 Likes

That was it! Thank you! I thought it was the other way around, that % was for local use only…

Again thank you!