Bashed into mariadb docker to create SQL database using:
CREATE DATABASE homeassistant;
CREATE USER homeassistantdb IDENTIFIED BY 'XXXXX;
GRANT ALL PRIVILEGES ON homeassistant.* TO homeassistantdb;
FLUSH PRIVILEGES;
I am getting the following error in home-assistant.log:
2018-10-23 17:20:59 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (_mysql_exceptions.OperationalError) (1045, “Access denied for user ‘homeassistantantdb’@‘172.17.0.1’ (using password: YES)”) (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation) (retrying in 3 seconds)
What is really confusing me is why my Docker Bridge networking GATEWAY ip is showing up in the error log and not IP I am assigning in the db_url of the configuration.yaml file …
Any help on what I did wrong or what I need to do to configure this properly would be greatly appreciated. I am trying to add mariadb into my configuration in order to increase the responsiveness of the Logbook UI.
As you can see, I’m using the host IP instead of the container IP as the latter can change when pulling and starting a new version. (My database is called hass)
Pardon the simple question, but are there instructions anywhere about how to create the database itself, or does your docker-compose file accomplish that without needing to create the DB through SQL code?
There are many guides on the web on how to create an SQL database but I don’t know of any that is specific to Home Assistant. That said, you’ll find most of the necessary commands in the first posts of this thread.
Nothing is done in the docker-compose file. On the first run you need to create a root user, that’s why you need to supply a root password in the docker run command (see post #1). Once the root user is created the password is not used anymore so it’s not needed in the compose file.
Very helpful, thank you. I didn’t understand that you needed to run those commands first prior to putting it into your docker-compose file. I’m still very much learning as I go.