Since I finally got it running I want to share the following with you:
I am running Homeassistant in a docker on a Synology NAS. - Works fine!
I want to change the recorder database to MariaDB which is installed and already running for other purposes.
I added in the config YAML:
'db_url: mysql://user:password@localhost:/Homeassistant?charset=utf8mb4
This actually connected properly and created all the tables in the database!!
But:
2023-05-19 16:38:18.616 ERROR (Recorder) [homeassistant.components.recorder.core] Error during connection setup:
(MySQLdb.OperationalError) (2002, āCanāt connect to local MySQL server through socket ā/run/mysqld/mysqld.sockā (2)ā)
Logger: homeassistant.setup
Source: setup.py:202
First occurred: 16:21:35 (4 occurrences)
Last logged: 16:21:44
Setup failed for history: (DependencyError(ā¦), āCould not setup dependencies: recorderā)
Setup failed for logbook: (DependencyError(ā¦), āCould not setup dependencies: recorderā)
Setup failed for energy: (DependencyError(ā¦), āCould not setup dependencies: history, recorderā)
Setup failed for default_config: (DependencyError(ā¦), āCould not setup dependencies: energy, history, logbookā)
I found in the settings of Mariadb on the Synology:
The port should be: 3307
The domain socked shall be: /run/mysqld/mysqld10.sock
I tried all variations of the upper configuration - and failed!
Finally I used a āremoteā connection to the MariaDB instead of ālocalhostā.
I got the error message: Access denied.
Well this was an easy one: I had to allow remote access (from all hosts) for the user in the database.
Finally the config string looks like this:
``db_url: mysql://user:password@ip-address-of-synology-nas:3307/Homeassistant?unix_socket=/run/mysqld/mysqld10.sock&charset=utf8mb4`Ā“
DONE!
My question: Why were the database tables created with the initial configuration while the actual data taking failed (Could not setup dependencies)?
Any idea?