MariaDB replacing built-in DB; can't get it to work

I’ve recently reinstalled everything on my Raspberry, including home assistant. I took the time to clean up and restructure some things, and now everything is running in a single docker-compose monstrocity, which works quite well.

One of the containers is for MariaDB, which is intended to replace the built-in database. However, I can’t seem to get it to work, for some reason; Home Assistant keeps saying it can’t connect to it.

My docker-compose for MariaDB:

mariadb:
restart: unless-stopped
container_name: mariadb
environment:
MYSQL_ROOT_PASSWORD: secretpasswordissecret
MYSQL_DATABASE: home_db
MYSQL_USER: pi
MYSQL_PASSWORD: secretpasswordissecret
volumes:
- ‘/home/pi/mariadb/msql/:/var/lib/mysql’
- ‘/home/pi/mariadb/conf/:/etc/mysql/conf.d’
ports:
- 8080:8080
- 3306:3306
image: jsurf/rpi-mariadb

And in my configuration in Home Assistant (just for the recorder:

recorder:
purge_keep_days: 90
db_url: mysql://pi:[email protected]:3306/home_db?charset=utf8
include:
domains:
- sensor
- switch
- media_player
exclude:
entities:
- sensor.last_boot
- sensor.date

Am I missing something?

Nobody replied, so I chose another approach.

I was facing similar issues. It worked in the beginning and after a while it stopped working.

The bind-address entry was creating trouble for me. I don’t know why it worked in the beginning but commenting out the bind-address solved the issues for. Maybe it is in issue due to cross container connection but others might know better.

Look for

/etc/mysql/mariadb.conf.d/50-server.cnf

in the MariaDB container and comment out

#bind-address = 127.0.0.1

This solved the issue for me. I was facing the same issue with grafana/influxDB and changing bind-address it in the respective mysql configuration file solved it.

I suspect that’s a different issue. Also, I have since chosen another approach.