Hi All
I’ve been spending quite some time on trying to use MariaDB as database.
I have not yet succeeded in making it work.
Could anyone help me in pointing to the errors?
I have homeassistant (not the hass io) running on my Synology in Docker.
I installed mysql CLI on my own pc to be able to connect/debug/…
I created a folder structure:
- /docker/mariadb/conf
- /docker/mariadb/conf/my.cnf (I mainly changed the binding to 0.0.0.0)
- /docker/mariadb/data (empty)
- /docker/mariadb/log (empty)
- /docker/mariadb/docker-compose.yml
I started the container using: sudo docker-compose up -d
Docker compose creates a new network, but I’ve not yet investigated how networks work. I did discover you can’t put MariaDB in bridge network (all my other containers are in bridge or host).
In the docker application on my synology dsm page I went to the terminal and executed
mysql -u root -p
CREATE DATABASE homeassistant;
CREATE USER 'homeassistant' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON homeassistant.* TO 'homeassistant'@'%' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
select user,host from mysql.user;
show grants for homeassistant;
exit;
(the @‘%’ is necessary to allow connections from any IP; as my homeassistant is on another network as the mariadb).
the last two commands are just to confirm what has been created.
I can now go to my own pc and connect to the mariaDB instance (with the root user and the homeassistant user).
mysql -u homeassistant -p -h 192.168.1.1
I did not manage to import my old database (gives me an error that the operator < is reserved for future use).
In my configuration.yaml I added
db_url: mysql://homeassistant:'123456'@192.168.1.1/homeassistant?charset=utf8
I restarted homeassistant from the webgui
and I see
Error during connection setup: (MySQLdb._exceptions.OperationalError) (1045, “Access denied for user ‘homeassistant’@‘192.168.0.5’ (using password: YES)”) (Background on this error at: Error Messages — SQLAlchemy 1.3 Documentation) (retrying in 3 seconds)
in my docker app in synology, in the log tab of the mariadb container, I also see a line saying the same thing.
I have the same issue using the root password.
I assume it’s not network related: otherwise I wouldn’t see the log message on the mariadb container.
I don’t assume it’s authentication related, otherwise I wouldn’t be able to connect from my pc
I DO assume it has something to do with the way homeassistant
What could be the issue here?
(i changed IP’s and passwords for privacy’s sake I might have mistyped them in the pastebins but they should be the same everywhere)